Sometimes we want to be able to get the OptionSetValue value from the label itself. One way is to use the metadata request and loop through it but this is a cumbersome way.
The easier way is to put those OptionSetValue data into an enum like this:
We use Description Attribute for the Label so that it supports string format.
Then we use this helper method:
And there you go. You can easily get the value like this:
Hope this helps,