예제 #1
0
        /// <summary>
        /// We ignore all properties as they, in the end, will only point to some computed state or other fields.
        /// Hence they do not provide information about the actual state of the object.
        /// </summary>
        public List <SanitizedFieldInfo> GetFields(Type type)
        {
            // we need all fields in order to get the private backing field of public properties
            var fields = new HarvestHelper().GetFields(type);
            var res    =
                fields.Where(
                    x =>
                    ((FieldInfo)x.FieldInfo).IsPublic ||
                    x.FieldInfo.Name.EndsWith(HarvestHelper.BackingFieldSuffix, StringComparison.Ordinal));

            return(res.ToList());
        }
        /// <summary>
        /// We ignore all properties as they, in the end, will only point to some computed state or other fields.
        /// Hence they do not provide information about the actual state of the object.
        /// </summary>
        public List<SanitizedFieldInfo> GetFields(Type type)
        {
            // we need all fields in order to get the private backing field of public properties
            var fields = new HarvestHelper().GetFields(type);
            var res =
                fields.Where(
                    x =>
                    ((FieldInfo)x.FieldInfo).IsPublic
                    || x.FieldInfo.Name.EndsWith(HarvestHelper.BackingFieldSuffix));

            return res.ToList();
        }
예제 #3
0
        /// <summary>
        /// Harvest only public fields and properties.
        /// </summary>
        public List <SanitizedFieldInfo> GetFields(Type type)
        {
            var fields = new HarvestHelper().GetFieldsAndProperties(type);

            return(fields.Where(IsPublic).ToList());
        }
        /// <summary>
        /// Harvest only public fields and properties.
        /// </summary>
        public List<SanitizedFieldInfo> GetFields(Type type)
        {
            var fields = new HarvestHelper().GetFieldsAndProperties(type);

            return fields.Where(IsPublic).ToList();
        }