カスタム属性を持つ Title という 1 つのプロパティを持つ Test というクラスがあるとします。
public class Test
{
[DatabaseField("title")]
public string Title { get; set; }
}
そして、DbField という拡張メソッド。C# でオブジェクト インスタンスからカスタム属性を取得することさえ可能かどうか疑問に思っています。
Test t = new Test();
string fieldName = t.Title.DbField();
//fieldName will equal "title", the same name passed into the attribute above
これはできますか?