Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

Howto compare OptionSetValues in C#

$
0
0

Hi,

currently i have a early bound entity (strongly typed class) of the entity account. This entity field (anyFieldNameA) of type OptionSetValue (Values: ValueA,ValueB,ValueC). The field anyFieldNameA is using an already existing OptionSet (AnyOptionset). I created with CrmSvcUtil.exe also the strongly typed class of this already existing OptionSet.

Now i want to compare those OptionSetValues. Currently i need to convert them to int and then it's working.

if(account.anyFieldNameA.Value == (int)AnyOptionset.ValueA) {}

Is there a nicer way to accomplish this?

Kind Regards

Markus


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>