Let's say I have a variable whose value (for example "listMovie") is the name of the member enum:
public enum Movies
{
regMovie = 1,
listMovie = 2
}
In this example, I would like to get the value 2. Is it possible? Here is what I tried:
public static void getMoviedata(string KeyVal)
{
if (Enum.IsDefined(typeof(TestAppAreana.MovieList.Movies), KeyVal))
{
((TestAppAreana.MovieList.Movies)2).ToString();
Enum.GetName(typeof(TestAppAreana.MovieList.Movies), 2);
}
}
source
share