|
-
March 23rd, 2012, 02:01 PM
#7
Re: filling a combobox with countries
 Originally Posted by thef1chesser
thnx it now works
since it was an ugly way I like to do those as short as possible.
Code:
if (!culture.CultureTypes.ToString().Contains("NeutralCultures"))
Instead of converting the enum field to a string and then parsing the string, just check if the NeutralCultures flag is present using a bitwise & operator.
Code:
if ( (culture.CultureTypes & CultureTypes.NeutralCultures ) != CultureTypes.NeutralCultures )
{
...
}
In general, avoid doing operations that convert items into strings whenever possible.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|