Вы можете использовать простой вспомогательный метод расширения, который будет выполняться только при отладке => этот метод будет записывать вывод в окно отладки
static class Extensions
{
[Conditional("DEBUG")]
public static void ShowAllProperties(this object obj)
{
var type = obj.GetType();
Debug.WriteLine(string.Format("Classname: {0}", type.Name));
var properties = type.GetProperties();
foreach (var property in properties)
{
//true will show inherited attributes as well
var attributes = property.GetCustomAttributes(true);
foreach (var attribute in attributes)
{
Debug.WriteLine(String.Format("'\t{0} - {1}", property, attribute));
}
}
}
}
которым могут быть вызваны другими классами, например, в их Конструктор.
class Book
{
[XmlElement("Author")]
public string Author { get; set; }
public Book()
{
this.ShowAllProperties();
}
}
это также будет работать с наследованием
class ComicBook
: Book
{
[XmlElement("ComicBookGenre")]
public string ComicbookGenre { get; set; }
public string ComicBookPublisher { get; set; }
}
С помощью отражения. Вы пытались выполнить поиск? – CodeCaster
@CodeCaster, спасибо за подсказку - я попробую отразить. – Dima
Это помогло мне, спасибо! – Dima