Retrieves the attribute instance of type T
for the property with the name given
by the Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.PropertyName property of the provided Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata
instance.
Declaration
public static T GetPropertyAttribute<T>(this ModelMetadata modelMetadata)where T : Attribute
Parameters
Type |
Name |
Description |
Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata |
modelMetadata |
The Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata instance representing a property. |
Returns
Type |
Description |
T |
Matching attribute instance of type T if a metadata container type is defined
and the requested property attribute exists, otherwise null .
|
Type Parameters