Open sandboxFocus

Method Default

Default(IType, bool)

Creates a TypedConstant representing the default value for the specified type. When rendered to code, this produces default(T) or default(T)! if hasNullForgivingOperator is true.

Declaration
public static TypedConstant Default(IType type, bool hasNullForgivingOperator = false)
Parameters
Type Name Description
IType type

The type for which to create a default value.

bool hasNullForgivingOperator

If true, the null-forgiving operator (!) will be appended to the rendered expression.

Returns
Type Description
TypedConstant

A TypedConstant representing default(T) or default(T)!.

See Also

Default(Type, bool)

Creates a TypedConstant representing the default value for the specified type. When rendered to code, this produces default(T) or default(T)! if hasNullForgivingOperator is true.

Declaration
public static TypedConstant Default(Type type, bool hasNullForgivingOperator = false)
Parameters
Type Name Description
Type type

The reflection Type for which to create a default value.

bool hasNullForgivingOperator

If true, the null-forgiving operator (!) will be appended to the rendered expression.

Returns
Type Description
TypedConstant

A TypedConstant representing default(T) or default(T)!.

See Also