title: Const Vs. Enum for Method Parameter
body: <p>I have a seemingly very basic question. I'm trying to decide whether or not constants strings would really be better than enums with MyEnum.ToString() called for a high performance application.</p>
  
  <p>I have a class, enum, method like this...</p>
  
  <pre><code>    Public Enum MyEnum
          MyValue1
          MyValue2
      End Enum
  
      Public Class MyImportantClass
  
              Public Sub Foo(ByVal enumerationValue As MyEnum)
  
              ' Some code in here that needs to do this at some point
              Dim str As String = enumerationValue.ToString()
  
      End Sub
  
      End Class
  </code></pre>
  
  <p>I understand enumerationValue.ToString() has some performance issues. However, another developer suggested instead of using Enums, use Constant Strings. My problem is that the method parameter is then a string, and the caller can then pass whatever he wants. Not just any string will work, obviously, so this is a run-time bug. </p>
  
  <pre><code>Public Sub Foo(ByVal enumerationValue As String)
  
      ' Some code in here that needs to do this at some point
      '   Dim str As String = enumerationValue
  
  End Sub
  </code></pre>
  
  <p>I want the safety of the enum, but the performance of a constant. As I said, I'm looking for a way to have my cake and eat it too.</p>