Open sandboxFocus

Method AddCase

AddCase(IType)

Adds a case to the union.

Declaration
void AddCase(IType caseType)
Parameters
Type Name Description
IType caseType

The type of the case.

Remarks

The compiler reports the case types of a union as a set, so adding a case whose type is already a case of this union throws an ArgumentException rather than declaring a second case.

The type of a case is an ordinary type declared elsewhere, and the union declares no type itself.

AddCase(Type)

Adds a case to the union.

Declaration
void AddCase(Type caseType)
Parameters
Type Name Description
Type caseType

The type of the case.

Remarks

The compiler reports the case types of a union as a set, so adding a case whose type is already a case of this union throws an ArgumentException rather than declaring a second case.

The type of a case is an ordinary type declared elsewhere, and the union declares no type itself.