public IEnumerable <PropertyInfo> GetProperties(Type targetType, BindingFlags bindingAttr) { XValidation.ArgumentNotNull(targetType, nameof(targetType)); List <PropertyInfo> propertyInfos = new List <PropertyInfo>(targetType.GetProperties(bindingAttr)); // GetProperties on an interface doesn't return properties from its interfaces if (XTypesBasic.IsInterface(targetType)) { foreach (Type i in targetType.GetInterfaces()) { propertyInfos.AddRange(i.GetProperties(bindingAttr)); } } XProperties.Api.GetChildPrivateProperties(propertyInfos, targetType, bindingAttr); // a base class private getter/setter will be inaccessible unless the property was gotten from the base class for (int i = 0; i < propertyInfos.Count; i++) { PropertyInfo member = propertyInfos[i]; if (member.DeclaringType != targetType) { PropertyInfo declaredMember = (PropertyInfo)GetMemberInfoFromType(member.DeclaringType, member); propertyInfos[i] = declaredMember; } } return(propertyInfos); }
public void FillInContextTable(object context, BasicIocContainer_I container) { if (context == null) { return; } var propertyValues = XTypesBasic.GetAllPropertyValues(context); // ReSharper disable once ForCanBeConvertedToForeach for (var i = 0; i < propertyValues.Length; i++) { var propertyValue = propertyValues[i]; if (propertyValue == null) { continue; } var type = propertyValue.PropertyType; var propertyObjectValue = propertyValue.Value; if (!container.ContainsType(type)) { container.Add(type, propertyObjectValue); } } }
public static bool IsEnum(this System.Type type) { return(XTypesBasic.IsEnum(type)); }
public static bool IsInterface(this System.Type type) { return(XTypesBasic.IsInterface(type)); }
public static bool IsGenericType(this System.Type t) { return(XTypesBasic.IsGenericType(t)); }
public static bool IsGenericTypeDefinition(this System.Type type) { return(XTypesBasic.IsGenericTypeDefinition(type)); }
public bool HasDefaultConstructor(Type t, bool nonPublic) { return(XTypesBasic.HasDefaultConstructor(t, nonPublic)); }
public static bool IsPrimitive(this System.Type t) { return(XTypesBasic.IsPrimitive(t)); }
public static bool IsAbstract(this System.Type type) { return(XTypesBasic.IsAbstract(type)); }
public static System.Type BaseType(this System.Type type) { return(XTypesBasic.BaseType(type)); }
public static bool AssignableToTypeName(this Type type, string fullTypeName, bool searchInterfaces) { return(XTypesBasic.AssignableToTypeName(type, fullTypeName, searchInterfaces)); }
/// <summary> /// Gets whether the specified type is a valuetype /// </summary> public bool IsValueType(Type type) { return(XTypesBasic.IsValueType(type)); }
public ConstructorInfo GetDefaultConstructor(Type t, bool nonPublic) { return(XTypesBasic.GetDefaultConstructor(t, nonPublic)); }
public ConstructorInfo GetDefaultConstructor(Type t) { return(XTypesBasic.GetDefaultConstructor(t)); }
public static bool IsNullableType(this System.Type t) { return(XTypesBasic.IsNullableType(t)); }
public static bool IsValueType(this System.Type t) { return(XTypesBasic.IsValueType(t)); }
public static bool IsDefined(this Type type, Type attributeType, bool inherit) { return(XTypesBasic.IsDefined(type, attributeType, inherit)); }
public static System.Reflection.Assembly Assembly(this System.Type type) { return(XTypesBasic.Assembly(type)); }
public static bool IsDelegate(this Type type) { return(XTypesBasic.IsDelegate(type)); }
public static bool IsGenericDefinition(this System.Type type, System.Type genericInterfaceDefinition) { return(XTypesBasic.IsGenericDefinition(type, genericInterfaceDefinition)); }
public Type GetObjectType(object v) { return(XTypesBasic.GetObjectType(v)); }