ParameterView.GetValueOrDefault Method

Definition

Overloads

GetValueOrDefault<TValue>(String)

Gets the value of the parameter with the specified name, or a default value if no such parameter exists in the collection.

GetValueOrDefault<TValue>(String, TValue)

Gets the value of the parameter with the specified name, or a specified default value if no such parameter exists in the collection.

GetValueOrDefault<TValue>(String)

Source:
ParameterView.cs
Source:
ParameterView.cs
Source:
ParameterView.cs
Source:
ParameterView.cs
Source:
ParameterView.cs
Source:
ParameterView.cs
Source:
ParameterView.cs

Gets the value of the parameter with the specified name, or a default value if no such parameter exists in the collection.

C#
public TValue GetValueOrDefault<TValue> (string parameterName);
C#
public TValue? GetValueOrDefault<TValue> (string parameterName);

Type Parameters

TValue

The type of the value.

Parameters

parameterName
String

The name of the parameter.

Returns

TValue

The parameter value if found; otherwise the default value for the specified type.

Applies to

ASP.NET Core 9.0 and other versions
Product Versions
ASP.NET Core 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

GetValueOrDefault<TValue>(String, TValue)

Source:
ParameterView.cs
Source:
ParameterView.cs
Source:
ParameterView.cs
Source:
ParameterView.cs
Source:
ParameterView.cs
Source:
ParameterView.cs
Source:
ParameterView.cs

Gets the value of the parameter with the specified name, or a specified default value if no such parameter exists in the collection.

C#
public TValue GetValueOrDefault<TValue> (string parameterName, TValue defaultValue);

Type Parameters

TValue

The type of the value.

Parameters

parameterName
String

The name of the parameter.

defaultValue
TValue

The default value to return if no such parameter exists in the collection.

Returns

TValue

The parameter value if found; otherwise defaultValue.

Applies to

ASP.NET Core 9.0 and other versions
Product Versions
ASP.NET Core 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0