2015-02-02 5 views

답변

0

당신은 속성을 반복 할 수 및 사용자 정의 속성 -

PropertyInfo[] properties = typeof(DoctorInfo).GetProperties(); 
      foreach (PropertyInfo prop in properties) 
      { 
       object[] attrs = prop.GetCustomAttributes(true); 

       foreach (object attr in attrs) 
       { 
        DisplayNameAttribute displayName = attr as DisplayNameAttribute; 
        if (displayName != null) 
        { 
         var attributeName = displayName.DisplayName; // check if this matches what you want 
        string propertyName = prop.Name;      } 
       } 
      } 
+0

코드가 내가 원하는 것을 정확 .. 감사합니다. –

관련 문제