2012-06-19 2 views
0

를 사용하여이 나는 반사를 통해 속성 이름 [demoaspect]을 나열 할 필요가점점 필드 속성 태그는 반사

foreach (FieldInfo targetfield in type.GetFields(BindingFlags.CreateInstance | BindingFlags.DeclaredOnly | BindingFlags.Default | BindingFlags.ExactBinding)) 
    { 

// here i need to list out those attributes...... 
} 

이러한 코드를 사용하고

<code> 
[demosapect] 
SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=xx;User ID=sa;"); 
</code> 

내 프로그램입니다!

그것은 내 쿼리 !!!!!!!!를 해결

if (targetfield.GetCustomAttributesData().Count > 0) 
       { 

        Console.WriteLine(targetfield.GetCustomAttributesData()[0].ToString()); 
       } 

로 ...... 당신의 응답을

답변

0

사용이 코드를 대기