WP7 and enum enumeration with Reflection

In WP7 we don’t have Enum.GetValues method. Below is one of solutions for its absence that returns array of enum initializers:

int[] x = typeof(MyEnum).GetFields().Where(z => z.IsLiteral).Select(z=>(int)z.GetValue(typeof(MyEnum))).ToArray();
Advertisements

0 Responses to “WP7 and enum enumeration with Reflection”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s





%d bloggers like this: