0
是否可以在不遍歷所有屬性列表的情況下讀取自定義屬性值?我使用下面的代碼來讀取屬性值attributeData.IncludeResult
,但我認爲應該更容易的更優化的方式來做到這一點,而不使用foreach
和迭代。獲取不帶迭代的屬性
foreach (var customAttributeData in
propertyInfo.GetCustomAttributes(typeof(WebClientAttribute), false))
{
var attributeData = (WebClientAttribute)customAttributeData;
myData = attributeData.IncludeResult
}