public IEnumerable<IValidationRule> ProvideRules(Type objectType, IEnumerable<string> standards)
        {
            List<IValidationRule> returnList = new List<IValidationRule>();
            List<Attribute> typeAttributes = new List<Attribute>(objectType.GetTypeInfo().GetCustomAttributes());

            foreach (IAttributeValidationRuleProvider attributeValidationRuleProvider in attributeValidationRuleProviders)
            {
                returnList.AddRange(attributeValidationRuleProvider.ProvideRules(objectType, typeAttributes, null, null));
            }

            foreach (PropertyInfo runtimeProperty in objectType.GetRuntimeProperties())
            {
                if (!runtimeProperty.CanRead ||
                     !runtimeProperty.GetMethod.IsPublic ||
                     runtimeProperty.GetMethod.IsStatic)
                {
                    continue;
                }

                foreach (IAttributeValidationRuleProvider attributeValidationRuleProvider in attributeValidationRuleProviders)
                {
                    List<Attribute> propertyAttributes = new List<Attribute>(runtimeProperty.GetCustomAttributes());

                    returnList.AddRange(attributeValidationRuleProvider.ProvideRules(objectType, typeAttributes, runtimeProperty, propertyAttributes));
                }
            }

            return returnList;
        }
Пример #2
0
    internal static IEnumerable<PropertyInfo> GetProperties(Type type) {
#if MONO || UNITY
      return type.GetProperties();
#else
      return type.GetRuntimeProperties();
#endif
    }
Пример #3
0
        private static string FormatCompledValue(object value, int depth, Type type)
        {
            if (depth == MAX_DEPTH)
                return String.Format("{0} {{ ... }}", type.Name);

            var fields = type.GetRuntimeFields()
                             .Where(f => f.IsPublic && !f.IsStatic)
                             .Select(f => new { name = f.Name, value = WrapAndGetFormattedValue(() => f.GetValue(value), depth) });
            var properties = type.GetRuntimeProperties()
                                 .Where(p => p.GetMethod != null && p.GetMethod.IsPublic && !p.GetMethod.IsStatic)
                                 .Select(p => new { name = p.Name, value = WrapAndGetFormattedValue(() => p.GetValue(value), depth) });
            var parameters = fields.Concat(properties)
                                   .OrderBy(p => p.name)
                                   .Take(MAX_OBJECT_PARAMETER_COUNT + 1)
                                   .ToList();

            if (parameters.Count == 0)
                return String.Format("{0} {{ }}", type.Name);

            var formattedParameters = String.Join(", ", parameters.Take(MAX_OBJECT_PARAMETER_COUNT)
                                                                  .Select(p => String.Format("{0} = {1}", p.name, p.value)));

            if (parameters.Count > MAX_OBJECT_PARAMETER_COUNT)
                formattedParameters += ", ...";

            return String.Format("{0} {{ {1} }}", type.Name, formattedParameters);
        }
Пример #4
0
        public static Sheet GetSheet(Type t)
        {
            var sheetAttr = (SheetAttribute)t.GetAttribute(typeof(SheetAttribute));
            var sheetName = sheetAttr != null ? sheetAttr.Name : t.Name;
            var definedColumn = sheetAttr != null ? sheetAttr.DefinedColumn : "";
            var startingComments = sheetAttr != null && sheetAttr.StartingComments != null ? sheetAttr.StartingComments.ToList() : new List<string>();

            var properties = from property in t.GetRuntimeProperties()
                    where (property.GetMethod != null && property.GetMethod.IsPublic)
                || (property.SetMethod != null && property.SetMethod.IsPublic)
                || (property.GetMethod != null && property.GetMethod.IsStatic)
                || (property.SetMethod != null && property.SetMethod.IsStatic)
                select property;

            var columns = new List<Column>();
            foreach(var property in properties)
            {
                var ignore = property.GetCustomAttribute(typeof(IgnoredColumnAttribute), true);

                if (property.CanWrite && ignore == null)
                {
                    columns.Add(new Column(property));
                }
            }

            return new Sheet(sheetName, columns, definedColumn, startingComments);
        }
        protected override JsTypeDefinition OnBuildRequest(Type t)
        {
            JsTypeDefinition typedefinition = new JsTypeDefinition(t.Name);

            //only instance /public method /prop***
            //MethodInfo[] methods = t.GetMethods(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
            var methods = t.GetRuntimeMethods();
            foreach (var met in methods)
            {
                if(!met.IsStatic && met.IsPublic)
                {
                    typedefinition.AddMember(new JsMethodDefinition(met.Name, met));
                }
            }

            //var properties = t.GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
            var properties = t.GetRuntimeProperties();
            //TODO finding GetProperties with BindingFlags
            foreach (var property in properties)
            {
                typedefinition.AddMember(new JsPropertyDefinition(property.Name, property)); 
            }

            return typedefinition;
        }
        /// <summary>
        /// Recursively gathers the list of all properties which depend
        /// on the provided property, whether directly or indirectly.
        /// Each dependent property will only be included once, so
        /// multiple or circular dependencies will not result in multiple
        /// <see cref="INotifyPropertyChanged.PropertyChanged"/> events.
        /// </summary>
        /// <param name="targetType">The object in which the properties reside.</param>
        /// <param name="propertyName">
        /// The name of the property for which to collect all dependent properties.
        /// </param>
        /// <returns>
        /// Returns the list of all properties which are directly or
        /// indirectly dependent on the original property.
        /// </returns>
        public static IEnumerable<PropertyInfo> GetAllDependants(Type targetType, string propertyName)
        {
            //Retrieve the Property Info for the specified property
            var propertyInfo = targetType.GetRuntimeProperties()
                .First(x => x.Name == propertyName);

            IEnumerable<PropertyInfo> oldResults = null;
            IEnumerable<PropertyInfo> results = new[] { propertyInfo };
            do
            {
                oldResults = results;

                var dependancies = from input in results
                                   from dependancy in GetDirectDependants(targetType, input.Name)
                                   select dependancy;

                //Create union of current results with "new" results,
                //making sure to remove duplicates
                results = results.Union(dependancies)
                    .GroupBy((x) => x.Name)
                    .Select(grp => grp.First());
            }
            while (results.Count() > oldResults.Count());

            //Return results not including the original property name
            return results.Where(x => (x.Name != propertyName));
        }
Пример #7
0
 /// <summary>
 /// Serialize a list of members from the object.
 /// </summary>
 /// <param name="serializer">The serializer to utilize when serializing the values.</param>
 /// <param name="type">The type of the object to serialize the members from.</param>
 /// <param name="value">The value to serialize the members from.</param>
 /// <returns>The list of members that make up the object.</returns>
 static IEnumerable<JsonMember> SerializeMembers(IJsonSerializer serializer, Type type, object value)
 {
     foreach (var property in type.GetRuntimeProperties().Where(p => p.CanRead))
     {
         yield return new JsonMember(serializer.FieldNamingStrategy.GetName(property.Name), serializer.SerializeValue(property.GetValue(value)));
     }
 }
Пример #8
0
        public static void ValidateContract(Type contract)
        {
            if (contract == null)
            {
                throw new ArgumentNullException(nameof(contract));
            }

            if (!contract.GetTypeInfo().IsInterface)
            {
                throw new InvalidOperationException(
                    $"Unable to use class '{contract.FullName}' as contract because only interface contracts are supported.");
            }

            if (contract.GetRuntimeProperties().Any())
            {
                throw new InvalidOperationException(
                    $"Unable to use interface '{contract.FullName}' as contract because it contains properties.");
            }

            IEnumerable<MethodInfo> methods = contract.GetRuntimeMethods().ToList();
            if (methods.Count() != methods.Select(m=>m.Name).Distinct().Count())
            {
                throw new InvalidOperationException(
                    $"Unable to use interface '{contract.FullName}' as contract because it methods with the same name.");
            }
        }
Пример #9
0
 public static List<PropertyInfo> GetProperties(Type type)
 {
     #if NETFX_CORE
     return type.GetRuntimeProperties().ToList();
     #else
     return type.GetProperties().ToList();
     #endif
 }
 public IEnumerable<PropertyInfo> GetPublicInstanceProperties(Type mappedType)
 {
     return from p in mappedType.GetRuntimeProperties()
         where
             ((p.GetMethod != null && p.GetMethod.IsPublic) || (p.SetMethod != null && p.SetMethod.IsPublic) ||
              (p.GetMethod != null && p.GetMethod.IsStatic) || (p.SetMethod != null && p.SetMethod.IsStatic))
         select p;
 }
Пример #11
0
 public static string[] GetPrimaryKey(Type type) {
     return new MemberInfo[0]
         .Concat(type.GetRuntimeProperties())
         .Concat(type.GetRuntimeFields())
         .Where(m => m.GetCustomAttributes(true).Any(i => i.GetType().Name == "KeyAttribute"))
         .Select(m => m.Name)
         .OrderBy(i => i)
         .ToArray();
 }
Пример #12
0
        public void Apply(Schema schema, SchemaRegistry schemaRegistry, Type type)
        {
            if (schema == null || schema.properties == null || type == null) return;

            bool isPushTrigger = type.AssemblyQualifiedNameNoTypeParams() == typeof(TriggerInput<string, string>).AssemblyQualifiedNameNoTypeParams();

            foreach (var propertyName in schema.properties.Keys)
            {
                var property = schema.properties[propertyName];

                if (isPushTrigger && propertyName == Constants.CALLBACK_URL_PROPERTY_NAME)
                {
                    #region Apply callback magic defaults

                    // Apply trigger magic defaults:
                    // "x-ms-scheduler-recommendation": "@accessKeys('default').primary.secretRunUri
                    schema.SetChildPropertyRequired(Constants.CALLBACK_URL_PROPERTY_NAME);

                    property.SetVisibility(VisibilityType.Internal);
                    property.SetSchedulerRecommendation(Constants.CALLBACK_URL_MAGIC_DEFAULT);

                    // This is what this will look like (pulled from HTTP Listener API Definition)
                    //
                    // "TriggerInput[TriggerPushParameters,TriggerOutputParameters]": {
                    //     "required": [            <-- SetChildPropertyRequired (on the parent model containing the callbackUrl property)
                    //       "callbackUrl"
                    // ],
                    // "type": "object",
                    // "properties": {
                    //   "callbackUrl": {            <-- SetSchedulerRecommendation (on the actual property)
                    //     "type": "string",
                    //     "x-ms-visibility": "internal",
                    //     "x-ms-scheduler-recommendation": "@accessKeys('default').primary.secretRunUri"
                    //   },

                    #endregion
                }

                // Apply friendly names and descriptions wherever possible
                // "x-ms-summary" - friendly name (applies to properties)
                // schema.properties["prop"].description - description (applies to parameters)

                var propertyInfo = type.GetRuntimeProperties().Where(p => p.Name == propertyName).FirstOrDefault();

                if (propertyInfo == null) return;

                var propertyMetadata = propertyInfo.GetCustomAttribute<MetadataAttribute>();

                if (propertyMetadata != null)
                {
                    property.SetVisibility(propertyMetadata.Visibility);
                    property.SetFriendlyNameAndDescription(propertyMetadata.FriendlyName, propertyMetadata.Description);
                }

            }
        }
 public IEnumerable<PropertyInfo> GetPublicInstanceProperties(Type mappedType)
 {
     if (mappedType == null)
     {
         throw new ArgumentNullException("mappedType");
     }
     return from p in mappedType.GetRuntimeProperties()
         where
             ((p.GetMethod != null && p.GetMethod.IsPublic) || (p.SetMethod != null && p.SetMethod.IsPublic) ||
              (p.GetMethod != null && p.GetMethod.IsStatic) || (p.SetMethod != null && p.SetMethod.IsStatic))
         select p;
 }
Пример #14
0
        public static IEnumerable<Property> GetProperties(Type type)
        {
            lock (PropertyCacheByType)
            {
                if (!PropertyCacheByType.ContainsKey(type))
                {
                    var properties = type.GetRuntimeProperties().Select(p => new Property(p, GetCustomAttributes(p))).ToList();
                    PropertyCacheByType[type] = properties;
                }

                return PropertyCacheByType[type];
            }
        }
Пример #15
0
 private static DbSetProperty[] FindSets(Type contextType)
     => contextType.GetRuntimeProperties()
         .Where(
             p => !p.IsStatic()
                  && !p.GetIndexParameters().Any()
                  && p.DeclaringType != typeof(DbContext)
                  && p.PropertyType.GetTypeInfo().IsGenericType
                  && p.PropertyType.GetGenericTypeDefinition() == typeof(DbSet<>))
         .OrderBy(p => p.Name)
         .Select(p => new DbSetProperty(
             p.DeclaringType, p.Name,
             p.PropertyType.GetTypeInfo().GenericTypeArguments.Single(), p.SetMethod != null))
         .ToArray();
Пример #16
0
        public static PropertyInfo GetProperty(Type sourceType, string propertyName)
        {
            var allProperties = sourceType.GetRuntimeProperties ();
            var property = allProperties.Where(
                mi => string.Equals(propertyName, mi.Name, StringComparison.Ordinal)).ToList();

            if (property.Count > 1)
            {
                throw new AmbiguousMatchException();
            }

            return property.FirstOrDefault();
        }
 private IValidationCollection BuildCollectionFor(Type type)
 {
     var validationCollection = new ValidationCollection();
     var properties = type.GetRuntimeProperties();
     foreach (var propertyInfo in properties)
     {
         var attributes = propertyInfo.GetCustomAttributes(true).OfType<ValidationAttribute>().ToArray();
         foreach (var validationAttribute in attributes)
         {
             validationCollection.Add(
                 new ValidationInfo(propertyInfo, validationAttribute.CreateValidation(propertyInfo.PropertyType), validationAttribute.Groups));
         }
     }
     return validationCollection;
 }
        public EntityTable(Type type)
        {
            this.Type = type;

            var properties = type.GetRuntimeProperties().ToList();
            this.columns = new List<EntityColumn>(properties.Count);

            foreach (var property in properties)
            {
                this.columns.Add(new EntityColumn(this, property));
            }

            this.Alias = this.TypeName;
            this.Name = this.GetTableName();
        }
Пример #19
0
        public static string FindSortableMember(Type entityType) {
            var candidates = Enumerable.Concat(
                entityType.GetRuntimeProperties()
                    .Where(i => i.CanRead && i.CanWrite && i.GetGetMethod(true).IsPublic && i.GetSetMethod(true).IsPublic)
                    .Select(i => new Candidate(i, i.PropertyType)),
                entityType.GetRuntimeFields()
                    .Where(i => i.IsPublic)
                    .Select(i => new Candidate(i, i.FieldType))
            );

            var codeFirstId = candidates.FirstOrDefault(IsEFCodeFirstConventionalKey);
            if(codeFirstId != null)
                return codeFirstId.Member.Name;

            return ORDERED_SORTABLE_TYPES.SelectMany(type => candidates.Where(c => c.Type == type)).FirstOrDefault()?.Member.Name;
        }
        protected DefaultStartupViewModel(IAccountsService accountsService, Type menuViewModelType)
        {
            AccountsService = accountsService;

            SelectedStartupView = AccountsService.ActiveAccount.DefaultStartupView;
            this.WhenAnyValue(x => x.SelectedStartupView).Skip(1).Subscribe(x =>
            {
                AccountsService.ActiveAccount.DefaultStartupView = x;
                AccountsService.Update(AccountsService.ActiveAccount);
                DismissCommand.ExecuteIfCan();
            });

            StartupViews = new ReactiveList<string>(from p in menuViewModelType.GetRuntimeProperties()
                let attr = p.GetCustomAttributes(typeof(PotentialStartupViewAttribute), true).ToList()
                where attr.Count == 1 && attr[0] is PotentialStartupViewAttribute
                select ((PotentialStartupViewAttribute)attr[0]).Name);
        }
Пример #21
0
		private IEnumerable<SQLiteConnection.ColumnInfo> GetExpectedColumnInfos (Type type)
		{
#if !NETFX_CORE
			var expectedValues = from prop in type.GetProperties (BindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty)
								 select new SQLiteConnection.ColumnInfo {
									 Name = prop.Name,
									 notnull = ((prop.GetCustomAttributes (typeof (NotNullAttribute), true).Count () == 0) && (prop.GetCustomAttributes (typeof (PrimaryKeyAttribute), true).Count () == 0)) ? 0 : 1
								 };
#else
			var expectedValues = from prop in type.GetRuntimeProperties ()
								 select new SQLiteConnection.ColumnInfo {
									 Name = prop.Name,
									 notnull = ((prop.GetCustomAttribute<NotNullAttribute> (true) == null) && (prop.GetCustomAttribute<PrimaryKeyAttribute> (true) == null)) ? 0 : 1
								 };
#endif

			return expectedValues;
		}
        public void TestIndexerHasAttribute(Type testObjectType, Type indexerType, Type attributeType, bool expectedResult)
        {
#if !WINRT
            var propertyInfo =
                testObjectType.GetProperties()
                    .First(pi => pi.Name == "Item" && pi.GetIndexParameters().Single().ParameterType == indexerType);
#else
            var propertyInfo =
                testObjectType.GetRuntimeProperties()
                              .First(pi => pi.Name == "Item" && pi.GetIndexParameters()
                                                                  .Single()
                                                                  .ParameterType == indexerType);
#endif

            var hasInjectAttribute = propertyInfo.HasAttribute(attributeType);

            hasInjectAttribute.Should().Be(expectedResult);
        }
Пример #23
0
        private static DbSetProperty[] FindSets(Type contextType)
        {
            var factory = new ClrPropertySetterFactory();

            return contextType.GetRuntimeProperties()
                .Where(
                    p => !p.IsStatic()
                         && !p.GetIndexParameters().Any()
                         && p.DeclaringType != typeof(DbContext)
                         && p.PropertyType.GetTypeInfo().IsGenericType
                         && p.PropertyType.GetGenericTypeDefinition() == typeof(DbSet<>))
                .OrderBy(p => p.Name)
                .Select(
                    p => new DbSetProperty(
                        p.Name,
                        p.PropertyType.GetTypeInfo().GenericTypeArguments.Single(),
                        p.SetMethod == null ? null : factory.Create(p)))
                .ToArray();
        }
        private IEnumerable<object> ParseSub(Type t, IParentNode node) {
            var values = new List<object>();
            //var ttt = typeof(IList<>).MakeGenericType(t);

            var eles = node.QuerySelectorAll(this.Selector);
            var ps = t.GetRuntimeProperties();
            foreach (var ele in eles) {
                var o = Activator.CreateInstance(t);

                var obj = Convert.ChangeType(o, t);

                foreach (var p in ps) {
                    var value = p.Parse(ele);
                    p.SetValue(obj, value);
                }

                values.Add(obj);
            }
            return values;
        }
Пример #25
0
        public ViewPropertiesHelper(Type sourceObjectType, Type targetObjectType)
        {
            Type type = sourceObjectType;
            var sourceObjectProperties = new List<BindableProperty>();
            while (type != typeof(View))
            {
                sourceObjectProperties.AddRange(type.GetRuntimeFields()
                    .Where(field => field.FieldType == typeof(BindableProperty))
                    .Select(field => field.GetValue(null))
                    .OfType<BindableProperty>());
                type = type.GetTypeInfo().BaseType;
            }

            List<PropertyInfo> targetProperties = targetObjectType.GetRuntimeProperties().ToList();
            foreach (var property in sourceObjectProperties)
            {
                if (targetProperties.Any(prop => prop.Name == property.PropertyName))
                {
                    properties.Add(property);
                }
            }
        }
Пример #26
0
            public TypeInfo(Type t)
            {
                //discover properties
                IEnumerable<PropertyInfo> properties = t.GetRuntimeProperties();
                foreach (PropertyInfo pi in properties)
                {
                   string name = pi.Name;

                   if(pi.GetMethod != null)
                   {
                  _propNameToGetter[name] = _ => pi.GetMethod.Invoke(_, null);
                   }
                }

                //discover fields
                IEnumerable<FieldInfo> fields = t.GetRuntimeFields();
                foreach(FieldInfo fi in fields)
                {
                   string name = fi.Name;

                   _propNameToGetter[name] = _ => fi.GetValue(_);
                }
            }
Пример #27
0
		private PropertyInfo GetPropertyInfo(string property, Type type)
		{
			List<PropertyInfo> allprops = type.GetRuntimeProperties().ToList();
			PropertyInfo propinfo =
				allprops.FirstOrDefault(
					x => string.Compare(x.Name, property, StringComparison.OrdinalIgnoreCase) == 0);
			return propinfo;
		}
Пример #28
0
        /// <summary>
        /// Creates the dynamic properties.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns>
        /// A dictionary of dynamic properties.
        /// </returns>
        private static IDictionary<string, IDynamicProperty> CreateDynamicProperties(Type type)
        {
            var dynamicProperties = new Dictionary<string, IDynamicProperty>();
            var propertyInfos = type.GetRuntimeProperties().Where(p => p.GetMethod != null && !p.GetMethod.IsStatic);
            foreach (var propertyInfo in propertyInfos)
            {
                var propertyName = propertyInfo.Name;
                if (propertyInfo.GetIndexParameters().Length > 0 || dynamicProperties.ContainsKey(propertyName))
                {
                    continue;
                }

                var runtimePropertyAccessorType = RuntimeDynamicPropertyGenericTypeInfo.MakeGenericType(
                    type,
                    propertyInfo.PropertyType);
                var constructor = runtimePropertyAccessorType.GetTypeInfo().DeclaredConstructors.First();
                var propertyAccessor = (IDynamicProperty)constructor.Invoke(new object[] { propertyInfo });
                dynamicProperties.Add(propertyName, propertyAccessor);
            }

            return dynamicProperties;
        }
Пример #29
0
 /// <summary>
 /// Gets all properties of a given type.
 /// </summary>
 /// <param name="type">Type of properties.</param>
 /// <returns>List of propertyies</returns>
 public IEnumerable<PropertyInfo> GetProperties(Type type)
 {
     return type.GetRuntimeProperties();
 }
Пример #30
0
		// internal for testing
		internal static IEnumerable<SerializingMember> GetTargetMembers( Type type )
		{
#if DEBUG && !UNITY
			Contract.Assert( type != null );
#endif // DEBUG && !UNITY
#if !NETFX_CORE
			var members =
				type.FindMembers(
					MemberTypes.Field | MemberTypes.Property,
					BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance,
					( member, criteria ) => CheckTargetEligibility( member ),
					null
				);
			var filtered = members.Where( item => Attribute.IsDefined( item, typeof( MessagePackMemberAttribute ) ) ).ToArray();
#else
			var members =
				type.GetRuntimeFields().Where( f => !f.IsStatic ).OfType<MemberInfo>()
					.Concat( type.GetRuntimeProperties().Where( p => p.GetMethod != null && !p.GetMethod.IsStatic ) )
					.Where( CheckTargetEligibility );
			var filtered = members.Where( item => item.IsDefined( typeof( MessagePackMemberAttribute ) ) ).ToArray();
#endif

			if ( filtered.Length > 0 )
			{
				return
					filtered.Select( member =>
						new SerializingMember(
							member,
							new DataMemberContract( member, member.GetCustomAttribute<MessagePackMemberAttribute>() )
						)
					);
			}

			if ( type.GetCustomAttributesData().Any( attr =>
				attr.GetAttributeType().FullName == "System.Runtime.Serialization.DataContractAttribute" ) )
			{
				return
					members.Select(
						item =>
						new
						{
							member = item,
							data = item.GetCustomAttributesData()
								.FirstOrDefault(
									data => data.GetAttributeType().FullName == "System.Runtime.Serialization.DataMemberAttribute" )
						}
					).Where( item => item.data != null )
					.Select(
						item =>
						{
							var name = item.data.GetNamedArguments()
								.Where( arg => arg.GetMemberName() == "Name" )
								.Select( arg => ( string )arg.GetTypedValue().Value )
								.FirstOrDefault();
							var id = item.data.GetNamedArguments()
								.Where( arg => arg.GetMemberName() == "Order" )
								.Select( arg => ( int? ) arg.GetTypedValue().Value )
								.FirstOrDefault();
#if SILVERLIGHT
							if ( id == -1 )
							{
								// Shim for Silverlight returns -1 because GetNamedArguments() extension method cannot recognize whether the argument was actually specified or not.
								id = null;
							}
#endif // SILVERLIGHT

							return
								new SerializingMember(
									item.member,
									new DataMemberContract( item.member, name, NilImplication.MemberDefault, id )
								);
						}
					);
			}
#if SILVERLIGHT || NETFX_CORE
			return members.Where( member => member.GetIsPublic() ).Select( member => new SerializingMember( member, new DataMemberContract( member ) ) );
#else
			return
				members.Where( item => item.GetIsPublic() && !Attribute.IsDefined( item, typeof( NonSerializedAttribute ) ) )
				.Select( member => new SerializingMember( member, new DataMemberContract( member ) ) );
#endif
		}
Пример #31
0
        public static PropertyInfo[] GetPublicInstanceProperties(this Type type)
        {
            var result = type.GetRuntimeProperties().ToArray();

            return(result);
        }
Пример #32
0
 public static IEnumerable <PropertyInfo> GetProperties(this Type t)
 {
     return(t.GetRuntimeProperties());
 }