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 SourceGetMapToApiAttributeValue(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, |
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. |
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 |
|