public class MyAttribute : Attribute { public string ConfigName { get; set; } } public class PropertyClass { [MyAttribute(ConfigName = "Some")] public string MyProperty { get; set; } public object PropertyValueByAttribute(string attributeName) { return this.GetType().GetProperties().Where(x => ((MyAttribute)(x.GetCustomAttributes(typeof(MyAttribute), false)[0])).ConfigName == "Some").ToList()[0].GetValue(this, null); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)