TypeRef Constructor (TypeRef, Object) |
Construct a
TypeRef from the specified type and constant value.
Namespace:
Nova.CodeDOM
Assembly:
Nova.CodeDOM (in Nova.CodeDOM.dll) Version: 7.44.8391.13415
Syntax public TypeRef(
TypeRef typeRef,
Object constantValue
)
Parameters
- typeRef
- Type: Nova.CodeDOMTypeRef
- constantValue
- Type: SystemObject
Remarks
If the specified TypeRef refers to an Enum type, the created TypeRef will reference a special EnumConstant
instance, which will hold the TypeRef of the enum type plus an instance object of the enum's underlying
type holding the constant value (it's not possible to reference an enum value member instead, because
the constant value of an enum might be outside the range of its members, or not have a one-to-one mapping
if it's a flags enum; it's also not possible to construct an instance of the enum type with the proper
constant value, since an EnumDecl might not be in a state that allows an instance to be created, and it
could be modified by editing, thus invalidating the type).
Otherwise, if the specified constant value isn't null, an attempt will be made to convert it to the
specified TypeRef. If the constant value is null, or the conversion attempt fails, then a null constant
of the specified TypeRef will be created.
See Also