Posted on: 5/19/2014 10:47:44 PM | Views : 470

I am trying to get the custom attributes out of one object and as well if the object has nested objects.  Is this possible?
Here is an example that will get the information for just a one level object (meaning no other objects within it)

public static IList<PropertyInformationDTO> GetDTOAttributes<T>() { IList<PropertyInformationDTO> theResults = new List<PropertyInformationDTO>(); PropertyInfo[] props = typeof(T).GetProperties(); foreach (PropertyInfo prop in props) { object[] attrs = prop.GetCustomAttributes(true); foreach (object attr in attrs) { DBColumnMappingAttribute dbColumnAttr = attr as DBColumnMappingAttribute; if (dbColumnAttr != null) { theResults.Add(new PropertyInformat ...

Go to the complete details ...