DisplayNameInfo.GetDisplayName(ValidateContext, String, Type) Method

Definition

Resolves the display name to use when reporting validation errors for the member.

public:
 abstract System::String ^ GetDisplayName(Microsoft::Extensions::Validation::ValidateContext ^ context, System::String ^ memberName, Type ^ declaringType);
public abstract string? GetDisplayName(Microsoft.Extensions.Validation.ValidateContext context, string memberName, Type? declaringType);
abstract member GetDisplayName : Microsoft.Extensions.Validation.ValidateContext * string * Type -> string
Public MustOverride Function GetDisplayName (context As ValidateContext, memberName As String, declaringType As Type) As String

Parameters

context
ValidateContext

The current validation context. Provides access to Localizer for implementations that delegate to IValidationLocalizer.

memberName
String

The CLR member name (property name, parameter name, or type name) being validated. Implementations may use this as a fallback display name or as a localization lookup key.

declaringType
Type

The type that declares the member, or null for top-level parameter validation where no declaring type is available.

Returns

The display name for the member, or null when no value can be produced. The validation pipeline falls back to memberName in the null case.

Applies to