ModelMetadata.FromLambdaExpression<TParameter, TValue> Method
Gets the metadata from the Expression parameter for the model.
Namespace: System.Web.Mvc
Assembly: System.Web.Mvc (in System.Web.Mvc.dll)
Syntax
'Declaration
Public Shared Function FromLambdaExpression(Of TParameter, TValue) ( _
expression As Expression(Of Func(Of TParameter, TValue)), _
viewData As ViewDataDictionary(Of TParameter) _
) As ModelMetadata
public static ModelMetadata FromLambdaExpression<TParameter, TValue>(
Expression<Func<TParameter, TValue>> expression,
ViewDataDictionary<TParameter> viewData
)
public:
generic<typename TParameter, typename TValue>
static ModelMetadata^ FromLambdaExpression(
Expression<Func<TParameter, TValue>^>^ expression,
ViewDataDictionary<TParameter>^ viewData
)
Type Parameters
- TParameter
The type of the parameter.
- TValue
The type of the value.
Parameters
- expression
Type: System.Linq.Expressions.Expression<Func<TParameter, TValue>>
An expression that identifies the model.
- viewData
Type: System.Web.Mvc.ViewDataDictionary<TParameter>
The view data dictionary.
Return Value
Type: System.Web.Mvc.ModelMetadata
The metadata for the model.
Remarks
This method is called by templated helpers to get model metadata. For more information, see Walkthrough: Using Templated Helpers to Display Data in ASP.NET MVC.