Dela via


DefaultHtmlGenerator.GetCurrentValues Method

Definition

Gets the collection of current values for the given expression.

public:
 virtual System::Collections::Generic::ICollection<System::String ^> ^ GetCurrentValues(Microsoft::AspNetCore::Mvc::Rendering::ViewContext ^ viewContext, Microsoft::AspNetCore::Mvc::ViewFeatures::ModelExplorer ^ modelExplorer, System::String ^ expression, bool allowMultiple);
public virtual System.Collections.Generic.ICollection<string> GetCurrentValues (Microsoft.AspNetCore.Mvc.Rendering.ViewContext viewContext, Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer modelExplorer, string expression, bool allowMultiple);
abstract member GetCurrentValues : Microsoft.AspNetCore.Mvc.Rendering.ViewContext * Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer * string * bool -> System.Collections.Generic.ICollection<string>
override this.GetCurrentValues : Microsoft.AspNetCore.Mvc.Rendering.ViewContext * Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer * string * bool -> System.Collections.Generic.ICollection<string>
Public Overridable Function GetCurrentValues (viewContext As ViewContext, modelExplorer As ModelExplorer, expression As String, allowMultiple As Boolean) As ICollection(Of String)

Parameters

viewContext
ViewContext

A ViewContext instance for the current scope.

modelExplorer
ModelExplorer

ModelExplorer for the expression. If null, calculates the expression result using Eval(String).

expression
String

Expression name, relative to the current model.

allowMultiple
Boolean

If true, require a collection expression result. Otherwise, treat result as a single value.

Returns

null if no expression result is found. Otherwise a ICollection<T> containing current values for the given expression.

Converts the expression result to a String. If that result is an IEnumerable type, instead converts each item in the collection and returns them separately.

If the expression result or the element type is an Enum, returns a String containing the integer representation of the Enum value as well as all Enum names for that value. Otherwise returns the default String conversion of the value.

Implements

Applies to