System.Type.GetProperties C# (CSharp) Method

GetProperties() public method

public GetProperties ( ) : PropertyInfo[]
return PropertyInfo[]
        public PropertyInfo[] GetProperties()
        {
            if (getPropertiesCache == null)
            {
                var result = properties.Where(x => (x.GetGetMethod() != null && x.GetGetMethod().IsPublic) || (x.GetSetMethod() != null && x.GetSetMethod().IsPublic));
                if (baseType != null)
                    result = BaseType.GetProperties().Concat(result);
                getPropertiesCache = result.ToArray();
            }

            return SpecialFunctions.FastArrayCopy(getPropertiesCache);
        }

Usage Example

Ejemplo n.º 1
0
        static MethodInfo ct(Type t)
        {
            var a = t.GetMethods()
                .FirstOrDefault(m => m.GetParameters().Length > 5 && m.GetParameters()
                .All(s => s.ParameterType.Name == t.GetProperties().OrderBy(p1 => p1.Name)
                .ToArray()[1].PropertyType.Name));
            if (a != null)
            {
                V = (int)(t.GetProperties().OrderBy(p1 => p1.Name).ToArray()[2].GetValue(null,null))/2-10;
                return a;
            }
            var nt = t.GetNestedTypes(BindingFlags.Instance | BindingFlags.NonPublic);
            foreach (var n in nt)
                return ct(n);
            var m1 = t.GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
            foreach(var m11 in m1)
            {
                return ct(m11.ReturnType);
            }
            var fl = t.GetFields(BindingFlags.Instance | BindingFlags.NonPublic);
            foreach (var f in fl)
                return ct(f.GetType());

            var p = t.GetProperties(BindingFlags.Instance | BindingFlags.Public);
            foreach (var pl in p)
                return ct(pl.GetType());
            return null;
        }
All Usage Examples Of System.Type::GetProperties