Get Registered Properties of Type

Get Registered Properties of Type

Old forum URL: forums.lhotka.net/forums/t/10265.aspx


GoGO posted on Friday, April 15, 2011

Hello.

In my scenario I need to get all registered properties of a type.

I inherited from ReadOnlyBase <T> and in my subclass wrote the following method

public static List<string> GetObjectProperties()

        {

            var o = (ReadOnlyBase<T>)Activator.CreateInstance(typeof(T));

            return o.FieldManager.GetRegisteredProperties().Where(p => !(

                            p.RelationshipType.HasFlag(RelationshipTypes.Child) ||

                            p.RelationshipType.HasFlag(RelationshipTypes.LazyLoad)

                         )).Select(p => p.Name).ToList();

        }

Is this correct? 

Copyright (c) Marimer LLC