Suppose I have:
class Person
{
[ColumnAttribute(\"ID\"]
public int Id;
[ColumnAttribute(\"Name\"]
public string Name;
[ColumnAttribute(\"DateOfBirth\"]
p
This is definitely doable without instantiating a Person
object. You'll want to use Reflection to access the attribute, specifically the GetCustomAttributes
method.
Here's an article for reference.
Your end result may end up looking something like this:
System.Attribute[] attrs = System.Attribute.GetCustomAttributes(typeof(Person)); // Reflection.