
Originally Posted by
purpleflash
....can someone explain why I have to cast to int since there is a reference to the class that contains the enumeration? I would think the cast would be unnecessary.....
When your SetContainerType is like
Code:
public void SetContainerType(int type){
....
}
Then you need to cast. as you are awaiting an integer here
if instead of this you have
Code:
public void SetContainerType(ContainerTypes type){
...
}
then this works without troubles. May I ask why you have it this way ?
Code:
public class class1
{
[FlagsAttribute]
public enum ContainerTypes : int
{
CT_OUTLOOK = 0,
CT_XML = 1,
CT_SDX = 2,
CT_SAP = 4
};
}
Instead of this
Code:
public enum ContainerTypes : int
{
CT_OUTLOOK = 0,
CT_XML = 1,
CT_SDX = 2,
CT_SAP = 4
};
public class class1 {
...whatever needs using your enum here
}
as the enum is public its quite useless to put it into the class, isn't it ? And use singular names for enum as you in every case have one of them.