This is my program
<code>
[demosapect]
SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=xx;User ID=sa;");
</code>
i am using these code as
foreach (FieldInfo targetfield in type.GetFields(BindingFlags.CreateInstance | BindingFlags.DeclaredOnly | BindingFlags.Default | BindingFlags.ExactBinding )) { // here i need to list out those attributes...... }
i need to list out the attribute name [demoaspect] through reflection!
Waiting for your response......
use this code as
if (targetfield.GetCustomAttributesData().Count > 0) { Console.WriteLine(targetfield.GetCustomAttributesData()[0].ToString()); }
It solves my query!!!!!!!!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.