S
SpotNet
Hello NewsGroup,
All the best for the New Year to you all. Have a question regarding enums
and the integer types that can be scoped as. Briefly, if I scope an enum as
uint, I cannot use the enum as a uint may be used generally, but must use it
as the enum.
For example:
public enum SomeUInt32Constants: uint
{
ThisConstant = 0x01121,
ThatConstant= 0x01123,
}
A function that has a uint parameter, or a value from SomeUInt32Constants
enum.
public void OperationDependingOnParamter(uint uiAconstantValue)
{
}
I cannot make the following call,
OperationDependingOnParamter(SomeUInt32Constants.ThisConstant). I can, but I
receive the appropriate casting error. I know this question is academic in
nature, though I ask on a pratical reason, is
SomeUInt32Constants.ThisConstant a uint (UInt32)? Please I'm aware of the
various approaches in passing a predefined constant (as well as any other
value not defined), my question is purely on the basis asked.
Thank you all very much NewsGroup, your responses are very much appreciated.
Regards and Happy New Year to you all,
SpotNet.
All the best for the New Year to you all. Have a question regarding enums
and the integer types that can be scoped as. Briefly, if I scope an enum as
uint, I cannot use the enum as a uint may be used generally, but must use it
as the enum.
For example:
public enum SomeUInt32Constants: uint
{
ThisConstant = 0x01121,
ThatConstant= 0x01123,
}
A function that has a uint parameter, or a value from SomeUInt32Constants
enum.
public void OperationDependingOnParamter(uint uiAconstantValue)
{
}
I cannot make the following call,
OperationDependingOnParamter(SomeUInt32Constants.ThisConstant). I can, but I
receive the appropriate casting error. I know this question is academic in
nature, though I ask on a pratical reason, is
SomeUInt32Constants.ThisConstant a uint (UInt32)? Please I'm aware of the
various approaches in passing a predefined constant (as well as any other
value not defined), my question is purely on the basis asked.
Thank you all very much NewsGroup, your responses are very much appreciated.
Regards and Happy New Year to you all,
SpotNet.