using System.Collections.Generic;
public static void Main()
var cat = new CategoriaGeralDTO() { Tipo_Documento = "ola", };
Type tipoAlvo = cat.GetType();
Dictionary<String,String> map = new Dictionary<string,String>();
PropertyInfo[] propCollection = tipoAlvo.GetProperties();
foreach (PropertyInfo property in propCollection)
foreach (var attribute in property.GetCustomAttributes(true))
if (attribute is IdentifierOnAdocDbAttribute)
var a = (IdentifierOnAdocDbAttribute) attribute;
map.ToList().ForEach(x => {
Console.WriteLine(x.Key + " => " + x.Value);
[AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
public class IdentifierOnAdocDbAttribute : Attribute
public String ID { get; private set; }
public String Name { get; private set; }
public IdentifierOnAdocDbAttribute(String id,String name)
public class CategoriaGeralDTO
[IdentifierOnAdocDb("40391","Tipo_Documento")]
public String Tipo_Documento { get; set; }
[IdentifierOnAdocDb("40392", "Tipo_Documento2")]
public String Tipo_Documento2 { get; set; }