Exemple #1
0
 protected TypeDisintegrator(HashSet <Type> types, Type type)
 {
     Types = new Type[0];
     if (types.Contains(type) == false && TypeDisintegrator._Valid(type))
     {
         Types = new TypeDisintegrator(type).Types;
     }
 }
Exemple #2
0
        public TypeDisintegrator(Type type)
        {
            var types = new HashSet <Type>();

            if (_IsAtom(type))
            {
                types.Add(type);
            }
            else if (_IsString(type))
            {
                types.Add(typeof(char));
                types.Add(typeof(char[]));
                types.Add(typeof(string));
            }
            else if (_IsArray(type))
            {
                types.Add(type);
                TypeDisintegrator._Add(
                    new[]
                {
                    type.GetElementType()
                },
                    types);
            }
            else if (_IsType(type))
            {
                if (TypeIdentifier.IsClass(type))
                {
                    types.Add(type);
                }

                TypeDisintegrator._Add(_GetEvents(type), types);
                TypeDisintegrator._Add(_GetPropertys(type), types);
                TypeDisintegrator._Add(_GetMethods(type), types);
                TypeDisintegrator._Add(_GetFields(type), types);
            }

            Types = types.ToArray();
        }