Open sandboxFocus

Method Create

Create(object?)

Declaration
public static TypedConstant Create(object? value)
Parameters
Type Name Description
object value
Returns
Type Description
TypedConstant

Create(object?, Type?)

Declaration
public static TypedConstant Create(object? value, Type? type)
Parameters
Type Name Description
object value
Type type
Returns
Type Description
TypedConstant

Create(object?, IType?)

Declaration
public static TypedConstant Create(object? value, IType? type)
Parameters
Type Name Description
object value
IType type
Returns
Type Description
TypedConstant

Create(IField)

Creates a TypedConstant that references a constant field. When rendered to code, this produces a reference to the field (e.g., MyClass.MyConstField) instead of the literal value.

Declaration
public static TypedConstant Create(IField field)
Parameters
Type Name Description
IField field

A constant field, i.e., ConstantValue must not be null.

Returns
Type Description
TypedConstant

A TypedConstant representing the field reference.

Exceptions
Type Condition
ArgumentException

Thrown when field is not a constant field.