in this simple class I try to overwrite ToString() to show all custom Attributes.
public class TryMe
{
public TryMe(int id, List<String> tests)
{
ID = id;
Tests = tests;
}
public int ID { get; set; }
public List<String> Tests { get; set; }
public override string ToString()
{
string me = "";
var attributes = this.GetType().GetCustomAttributes();
foreach (var attribute in attributes)
{
me = me + attribute.ToString() + ",";
}
return me;
}
}
It doesn't show any value or error.
Aren't ID
and Tests
custom attributes ?
Is there any easy enumeration if the class becomes bigger ?