Show / Hide Table of Contents

    Method GetPropertyAttribute

    GetPropertyAttribute<T>(ModelMetadata)

    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
    Name Description
    T Attribute type to lookup.
    Back to top Copyright © 2017-2018, xplo.re IT Services, Michael Maier. All rights reserved.