S
Stuart Baker
HI there:
Without delving into too much detail I wish to accomplish
the following:
Given:
enum enumError
{
TooBig,
TooSmall,
Mandatory,
}
const string TooBig = "Oi - this exceeds your limit!";
const string TooSmall = "oooh! Not big enough!";
const string Mandatory = "just got to have it!";
private string GetErrorMessage(enumError err)
{
// what goes here to convert err into
// the required constant?
}
I have found some ways around using reflection but these
are not want I wanted to achieve. For example a hashTable
keyed on (int)err or inedxing into an array... I was just
hoping for a soluition using reflection. I've managed to
convert strings to enum - this one stumps me though
Help would be gratefully received.
Stu
Without delving into too much detail I wish to accomplish
the following:
Given:
enum enumError
{
TooBig,
TooSmall,
Mandatory,
}
const string TooBig = "Oi - this exceeds your limit!";
const string TooSmall = "oooh! Not big enough!";
const string Mandatory = "just got to have it!";
private string GetErrorMessage(enumError err)
{
// what goes here to convert err into
// the required constant?
}
I have found some ways around using reflection but these
are not want I wanted to achieve. For example a hashTable
keyed on (int)err or inedxing into an array... I was just
hoping for a soluition using reflection. I've managed to
convert strings to enum - this one stumps me though
Help would be gratefully received.
Stu