예제 #1
0
        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);
        }
예제 #2
0
        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);
                }
            }
        }
예제 #3
0
 public static bool IsEnum(this System.Type type)
 {
     return(XTypesBasic.IsEnum(type));
 }
예제 #4
0
 public static bool IsInterface(this System.Type type)
 {
     return(XTypesBasic.IsInterface(type));
 }
예제 #5
0
 public static bool IsGenericType(this System.Type t)
 {
     return(XTypesBasic.IsGenericType(t));
 }
예제 #6
0
 public static bool IsGenericTypeDefinition(this System.Type type)
 {
     return(XTypesBasic.IsGenericTypeDefinition(type));
 }
예제 #7
0
 public bool HasDefaultConstructor(Type t, bool nonPublic)
 {
     return(XTypesBasic.HasDefaultConstructor(t, nonPublic));
 }
예제 #8
0
 public static bool IsPrimitive(this System.Type t)
 {
     return(XTypesBasic.IsPrimitive(t));
 }
예제 #9
0
 public static bool IsAbstract(this System.Type type)
 {
     return(XTypesBasic.IsAbstract(type));
 }
예제 #10
0
 public static System.Type BaseType(this System.Type type)
 {
     return(XTypesBasic.BaseType(type));
 }
예제 #11
0
 public static bool AssignableToTypeName(this Type type, string fullTypeName, bool searchInterfaces)
 {
     return(XTypesBasic.AssignableToTypeName(type, fullTypeName, searchInterfaces));
 }
예제 #12
0
 /// <summary>
 /// Gets whether the specified type is a valuetype
 /// </summary>
 public bool IsValueType(Type type)
 {
     return(XTypesBasic.IsValueType(type));
 }
예제 #13
0
 public ConstructorInfo GetDefaultConstructor(Type t, bool nonPublic)
 {
     return(XTypesBasic.GetDefaultConstructor(t, nonPublic));
 }
예제 #14
0
 public ConstructorInfo GetDefaultConstructor(Type t)
 {
     return(XTypesBasic.GetDefaultConstructor(t));
 }
예제 #15
0
 public static bool IsNullableType(this System.Type t)
 {
     return(XTypesBasic.IsNullableType(t));
 }
예제 #16
0
 public static bool IsValueType(this System.Type t)
 {
     return(XTypesBasic.IsValueType(t));
 }
예제 #17
0
 public static bool IsDefined(this Type type, Type attributeType, bool inherit)
 {
     return(XTypesBasic.IsDefined(type, attributeType, inherit));
 }
예제 #18
0
 public static System.Reflection.Assembly Assembly(this System.Type type)
 {
     return(XTypesBasic.Assembly(type));
 }
예제 #19
0
 public static bool IsDelegate(this Type type)
 {
     return(XTypesBasic.IsDelegate(type));
 }
예제 #20
0
 public static bool IsGenericDefinition(this System.Type type, System.Type genericInterfaceDefinition)
 {
     return(XTypesBasic.IsGenericDefinition(type, genericInterfaceDefinition));
 }
예제 #21
0
 public Type GetObjectType(object v)
 {
     return(XTypesBasic.GetObjectType(v));
 }