AddMember(string)
Adds a member whose value the language assigns, which is zero for the first member and the value of the preceding member plus one for any other.
Declaration
IEnumMemberBuilder AddMember(string name)Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the member. |
Returns
| Type | Description |
|---|---|
| IEnumMemberBuilder | An IEnumMemberBuilder that allows you to add custom attributes to the new member. |
Remarks
The name must not be the name of a member already added, and a duplicate throws an ArgumentException. The members are declared in the order in which they were added.
AddMember(string, sbyte)
Adds a member of the given value.
Declaration
IEnumMemberBuilder AddMember(string name, sbyte value)Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the member. |
| sbyte | value | The value of the member, converted to UnderlyingType. |
Returns
| Type | Description |
|---|---|
| IEnumMemberBuilder | An IEnumMemberBuilder that allows you to add custom attributes to the new member. |
Remarks
The name must not be the name of a member already added, and a duplicate throws an ArgumentException. The value is converted to UnderlyingType, and a value that does not fit in that type throws an ArgumentOutOfRangeException. The members are declared in the order in which they were added.
AddMember(string, byte)
Adds a member of the given value.
Declaration
IEnumMemberBuilder AddMember(string name, byte value)Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the member. |
| byte | value | The value of the member, converted to UnderlyingType. |
Returns
| Type | Description |
|---|---|
| IEnumMemberBuilder | An IEnumMemberBuilder that allows you to add custom attributes to the new member. |
Remarks
The name must not be the name of a member already added, and a duplicate throws an ArgumentException. The value is converted to UnderlyingType, and a value that does not fit in that type throws an ArgumentOutOfRangeException. The members are declared in the order in which they were added.
AddMember(string, short)
Adds a member of the given value.
Declaration
IEnumMemberBuilder AddMember(string name, short value)Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the member. |
| short | value | The value of the member, converted to UnderlyingType. |
Returns
| Type | Description |
|---|---|
| IEnumMemberBuilder | An IEnumMemberBuilder that allows you to add custom attributes to the new member. |
Remarks
The name must not be the name of a member already added, and a duplicate throws an ArgumentException. The value is converted to UnderlyingType, and a value that does not fit in that type throws an ArgumentOutOfRangeException. The members are declared in the order in which they were added.
AddMember(string, ushort)
Adds a member of the given value.
Declaration
IEnumMemberBuilder AddMember(string name, ushort value)Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the member. |
| ushort | value | The value of the member, converted to UnderlyingType. |
Returns
| Type | Description |
|---|---|
| IEnumMemberBuilder | An IEnumMemberBuilder that allows you to add custom attributes to the new member. |
Remarks
The name must not be the name of a member already added, and a duplicate throws an ArgumentException. The value is converted to UnderlyingType, and a value that does not fit in that type throws an ArgumentOutOfRangeException. The members are declared in the order in which they were added.
AddMember(string, int)
Adds a member of the given value.
Declaration
IEnumMemberBuilder AddMember(string name, int value)Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the member. |
| int | value | The value of the member, converted to UnderlyingType. |
Returns
| Type | Description |
|---|---|
| IEnumMemberBuilder | An IEnumMemberBuilder that allows you to add custom attributes to the new member. |
Remarks
The name must not be the name of a member already added, and a duplicate throws an ArgumentException. The value is converted to UnderlyingType, and a value that does not fit in that type throws an ArgumentOutOfRangeException. The members are declared in the order in which they were added.
AddMember(string, uint)
Adds a member of the given value.
Declaration
IEnumMemberBuilder AddMember(string name, uint value)Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the member. |
| uint | value | The value of the member, converted to UnderlyingType. |
Returns
| Type | Description |
|---|---|
| IEnumMemberBuilder | An IEnumMemberBuilder that allows you to add custom attributes to the new member. |
Remarks
The name must not be the name of a member already added, and a duplicate throws an ArgumentException. The value is converted to UnderlyingType, and a value that does not fit in that type throws an ArgumentOutOfRangeException. The members are declared in the order in which they were added.
AddMember(string, long)
Adds a member of the given value.
Declaration
IEnumMemberBuilder AddMember(string name, long value)Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the member. |
| long | value | The value of the member, converted to UnderlyingType. |
Returns
| Type | Description |
|---|---|
| IEnumMemberBuilder | An IEnumMemberBuilder that allows you to add custom attributes to the new member. |
Remarks
The name must not be the name of a member already added, and a duplicate throws an ArgumentException. The value is converted to UnderlyingType, and a value that does not fit in that type throws an ArgumentOutOfRangeException. The members are declared in the order in which they were added.
AddMember(string, ulong)
Adds a member of the given value.
Declaration
IEnumMemberBuilder AddMember(string name, ulong value)Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the member. |
| ulong | value | The value of the member, converted to UnderlyingType. |
Returns
| Type | Description |
|---|---|
| IEnumMemberBuilder | An IEnumMemberBuilder that allows you to add custom attributes to the new member. |
Remarks
The name must not be the name of a member already added, and a duplicate throws an ArgumentException. The value is converted to UnderlyingType, and a value that does not fit in that type throws an ArgumentOutOfRangeException. The members are declared in the order in which they were added.
AddMember(string, TypedConstant)
Adds a member whose value is given as a TypedConstant, which is the form in which the value of a member of another enum is read.
Declaration
IEnumMemberBuilder AddMember(string name, TypedConstant value)Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the member. |
| TypedConstant | value | The value of the member, converted to UnderlyingType. |
Returns
| Type | Description |
|---|---|
| IEnumMemberBuilder | An IEnumMemberBuilder that allows you to add custom attributes to the new member. |
Remarks
The name must not be the name of a member already added, and a duplicate throws an ArgumentException. The type of the constant must be an integral type or an enum, and any other type throws an ArgumentException as well. This overload therefore accepts the value of a member of another enum directly, which is how such a value is read from the code model.
The value is converted to UnderlyingType and the type of the constant is replaced by it, including when the constant came from another enum. The language converts neither one enum to another nor an enum to an integral type implicitly, so a member that kept the type of the constant it came from would not compile. A value that does not fit in the underlying type throws an ArgumentOutOfRangeException.
An uninitialized constant, and a constant whose value is null, add a member whose value the language
assigns, exactly as AddMember(string) does.