Exemple #1
0
        public Module Module;                // ex RunCode_00002.dll

        public TypeValueInfo(Type sourceType, MemberInfo memberInfo)
        {
            SourceType = sourceType;
            Name       = memberInfo.Name;
            TreeName   = memberInfo.Name;
            ParentName = null;

            Type valueType      = memberInfo.zGetValueType();
            Type enumerableType = null;

            if (valueType != typeof(string))
            {
                enumerableType = zReflection.GetEnumerableType(valueType);
            }
            if (enumerableType != null)
            {
                ValueType    = enumerableType;
                IsEnumerable = true;
            }
            else
            {
                ValueType    = valueType;
                IsEnumerable = false;
            }

            IsValueType   = TypeReflection.IsValueType(ValueType);
            DeclaringType = memberInfo.DeclaringType;
            ReflectedType = memberInfo.ReflectedType;
            MemberTypes   = memberInfo.MemberType;
            MetadataToken = memberInfo.MetadataToken;
            Module        = memberInfo.Module;
        }
Exemple #2
0
        public TypeValueInfo(Type valueType)
        {
            SourceType = null;
            Name       = null;
            TreeName   = null;
            ParentName = null;

            Type enumerableType = null;

            if (valueType != typeof(string))
            {
                enumerableType = zReflection.GetEnumerableType(valueType);
            }
            if (enumerableType != null)
            {
                ValueType    = enumerableType;
                IsEnumerable = true;
            }
            else
            {
                ValueType    = valueType;
                IsEnumerable = false;
            }

            IsValueType   = TypeReflection.IsValueType(ValueType);
            DeclaringType = null;
            ReflectedType = null;
            MemberTypes   = 0;
            MetadataToken = 0;
            Module        = valueType.Module;
        }
Exemple #3
0
        public static IEnumerable <TreeValue <TypeValueInfo> > GetAllValuesInfos(Type type, MemberType memberType = MemberType.Instance | MemberType.Public | MemberType.Field | MemberType.Property,
                                                                                 TypeReflectionOptions options    = TypeReflectionOptions.ValueType | TypeReflectionOptions.NotValueType, Func <TypeValueInfo, TreeFilter> filter = null)
        {
            TypeReflection typeReflection = new TypeReflection();

            typeReflection._bindingFlags = GetBindingFlags(memberType);
            typeReflection._memberTypes  = GetMemberTypes(memberType);
            typeReflection._filter       = filter;
            //typeReflection._verbose = verbose;
            if ((options & TypeReflectionOptions.Source) == TypeReflectionOptions.Source)
            {
                typeReflection._returnSource = true;
            }
            if ((options & TypeReflectionOptions.Parent) == TypeReflectionOptions.Parent)
            {
                typeReflection._returnParent = true;
            }
            if ((options & TypeReflectionOptions.ValueType) == TypeReflectionOptions.ValueType)
            {
                typeReflection._returnValueType = true;
            }
            if ((options & TypeReflectionOptions.NotValueType) == TypeReflectionOptions.NotValueType)
            {
                typeReflection._returnNotValueType = true;
            }
            return(typeReflection._GetAllValuesInfos(type));
        }
Exemple #4
0
 public static IEnumerable<TreeValue<TypeValueInfo>> GetAllValuesInfos(Type type, MemberType memberType = MemberType.Instance | MemberType.Public | MemberType.Field | MemberType.Property,
     TypeReflectionOptions options = TypeReflectionOptions.ValueType | TypeReflectionOptions.NotValueType, Func<TypeValueInfo, TreeFilter> filter = null)
 {
     TypeReflection typeReflection = new TypeReflection();
     typeReflection._bindingFlags = GetBindingFlags(memberType);
     typeReflection._memberTypes = GetMemberTypes(memberType);
     typeReflection._filter = filter;
     //typeReflection._verbose = verbose;
     if ((options & TypeReflectionOptions.Source) == TypeReflectionOptions.Source)
         typeReflection._returnSource = true;
     if ((options & TypeReflectionOptions.Parent) == TypeReflectionOptions.Parent)
         typeReflection._returnParent = true;
     if ((options & TypeReflectionOptions.ValueType) == TypeReflectionOptions.ValueType)
         typeReflection._returnValueType = true;
     if ((options & TypeReflectionOptions.NotValueType) == TypeReflectionOptions.NotValueType)
         typeReflection._returnNotValueType = true;
     return typeReflection._GetAllValuesInfos(type);
 }
Exemple #5
0
 public static IEnumerable <TreeValue <TypeValueInfo> > zGetTypeAllValuesInfos(this Type type, MemberType memberType = MemberType.Instance | MemberType.Public | MemberType.Field | MemberType.Property,
                                                                               TypeReflectionOptions options         = TypeReflectionOptions.ValueType | TypeReflectionOptions.NotValueType, Func <TypeValueInfo, TreeFilter> filter = null)
 {
     return(TypeReflection.GetAllValuesInfos(type, memberType, options, filter));
 }
Exemple #6
0
 public static IEnumerable <TypeValueInfo> zGetTypeValuesInfos(this Type type, BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Public, MemberTypes memberTypes = MemberTypes.All)
 {
     return(TypeReflection.GetValuesInfos(type, bindingFlags, memberTypes));
 }
Exemple #7
0
 public static IEnumerable <TypeValueInfo> zGetTypeValuesInfos(this Type type, MemberType memberType = MemberType.Instance | MemberType.Public | MemberType.Field | MemberType.Property)
 {
     return(TypeReflection.GetValuesInfos(type, memberType));
 }
Exemple #8
0
 public static TypeValueInfo zGetTypeValueInfo(this Type type, string name, MemberType memberType = MemberType.Instance | MemberType.Public | MemberType.Field | MemberType.Property)
 {
     return(TypeReflection.GetValueInfo(type, name, memberType));
 }