I have the following enumerated type:
/// <summary>
/// TTE Node types.
/// </summary>
public enum E_TTE_NODES
{
/// <summary>
/// Represents FCM 0
/// </summary>
E_FCM0 = 0,
/// <summary>
/// Represents FCM 1
/// </summary>
E_FCM1,
/// <summary>
/// Represents FCM 2
/// </summary>
E_FCM2,
/// <summary>
/// Represents DCM 0
/// </summary>
E_DCM0,
/// <summary>
/// Represents DCM 1
/// </summary>
E_DCM1,
/// <summary>
/// Represents DCM 2
/// </summary>
E_DCM2,
/// <summary>
/// Represents CCM 0
/// </summary>
E_CCM0,
/// <summary>
/// Represents CCM 1
/// </summary>
E_CCM1,
/// <summary>
/// Represents CCM 2
/// </summary>
E_CCM2,
/// <summary>
/// Represents PDU C1
/// </summary>
E_PDU_C1,
/// <summary>
/// Represents the last node.
/// Must remain last.
/// </summary>
E_LAST,
}
I would like to initialize a generic list like this:
// Should initialize to a capacity of 10
private List<Int32> transmitIndex = new List<Int32>((Int32)E_TTE_NODES.E_LAST);
Yes, I know I can just pass the number 10 as a parameter. The enum may add more nodes in the future, but E_LAST
will always be the last node. My question is my does the compiler say I cannot cast my enum to an int on the above line of code. Isn't the default value of a enum value an integer?