Search Results for

    Show / Hide Table of Contents
    View Source

    Class MethodInfoApiCommonExtensions

    Extension methods for System.Reflection.MethodInfo to work with API-related attributes.

    Inheritance
    object
    Namespace: Umbraco.Extensions
    Assembly: Umbraco.Cms.Api.Common.dll
    Syntax
    public static class MethodInfoApiCommonExtensions

    Methods

    View Source

    GetMapToApiAttributeValue(MethodInfo)

    Gets the API name from MapToApiAttribute applied to the method's declaring type.

    Declaration
    public static string? GetMapToApiAttributeValue(this MethodInfo methodInfo)
    Parameters
    Type Name Description
    MethodInfo methodInfo

    The method info to inspect.

    Returns
    Type Description
    string

    The API name if the attribute is present; otherwise, null.

    View Source

    GetMapToApiVersionAttributeValue(MethodInfo)

    Gets the API version values from Asp.Versioning.MapToApiVersionAttribute applied to the method.

    Declaration
    public static string GetMapToApiVersionAttributeValue(this MethodInfo methodInfo)
    Parameters
    Type Name Description
    MethodInfo methodInfo

    The method info to inspect.

    Returns
    Type Description
    string

    A pipe-separated string of API version values.

    View Source

    HasMapToApiAttribute(MethodInfo, string)

    Determines whether the method's declaring type has a MapToApiAttribute with the specified API name.

    Declaration
    public static bool HasMapToApiAttribute(this MethodInfo methodInfo, string apiName)
    Parameters
    Type Name Description
    MethodInfo methodInfo

    The method info to inspect.

    string apiName

    The API name to check for.

    Returns
    Type Description
    bool

    true if the attribute is present and matches the specified API name, or if the attribute is not present and the API name matches the default API name; otherwise, false.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX