Enum.TryParse(.NET 4.0)

added by baldi
6/15/2010 1:02:39 AM

0 Kicks, 64 Views

Since .NET 4.0 the Enum class contains also a TryParse method. The method, which is supported in other basic data types already since version 2.0, allows to pass in a value which will be checked if it can be converted into the defined type. The TryParse method allows you to procude better readable and shorter code.