P
pinkfloydfan
Hi there
I have the following situation...I want to perform an operation on an
Enum parameter but I don't know which one of a number of Enums it will
be on.
The function would include something like the following:
public static object (string EnumName)
{
....
EnumName NewEnum = new EnumName();
return NewEnum;
}
So, what I am trying to do is to create an instance of the specific
Enum whose name is held by the string EnumName. I am doing this
because exactly the same operation is being performed on all the Enums
and I just thought it would be neater to have it in a single function.
Is this possible?
Would object be the right return type given that I now want to use
NewEnum in another function that is looking for that specific variable
type?
I am very new to C# so if anyone can help it would be appreciated.
Thanks a lot
I have the following situation...I want to perform an operation on an
Enum parameter but I don't know which one of a number of Enums it will
be on.
The function would include something like the following:
public static object (string EnumName)
{
....
EnumName NewEnum = new EnumName();
return NewEnum;
}
So, what I am trying to do is to create an instance of the specific
Enum whose name is held by the string EnumName. I am doing this
because exactly the same operation is being performed on all the Enums
and I just thought it would be neater to have it in a single function.
Is this possible?
Would object be the right return type given that I now want to use
NewEnum in another function that is looking for that specific variable
type?
I am very new to C# so if anyone can help it would be appreciated.
Thanks a lot