.net - Convert Enum to String -


What is the most popular way of converting a string into NOM 3.5.0?

  • Enum.GetName
  • Enum.Format
  • toString

Why I like one of these should do? Does a Better Performer?

Best of all I can find, in which there is an XML snippet that answers this question None of them share the same defect: They call enum.toString () , which does not work properly while using other indirect attacks (GetName and format) . Unfortunately, I can not tell any reason to use any of the above

By passing a boxing enum to the string,

Other functions can be resulted in enum.ToString () when Dotfasking is done This will create problems. You can use enum.ToString () , enum.GetNames () , enum.GetName () , enum.Format () Should not () or enum.Parse () to convert an enum to a string. Instead, use a switch statement, and if necessary, the name should also be internationalized.


Comments