title: VB.NET Select...Case Statement Equivalent in C#
body: <p>I just started using C# and I've got a couple of issues.
  Is there any way to code the C# equivalent of the VB.NET Select statement like the following?</p>
  
  <pre class="lang-vb prettyprint-override"><code>Select Object.Name.ToString()
      Case "Name1"
          'Do something
      Case "Name2"
          'Do something else
      Case Else
          'Do the default action
  End Select
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>
  
  <hr>
  
  <p>Thanks for the input so far now what about if I hook several controls to one event handler as in the following and I want to perform a slightly different action for each control:</p>
  
  <pre class="lang-vb prettyprint-override"><code>Private Sub Button_Click(sender as Object, e as EventArgs) _
    Handles button1.Click, Button2.Click
  
      'do a general activity
  
      Select CType(sender, Button).Name
          Case button1.Name
              'do something
          Case button2.Name
              'do something else
          Case Else
              'do the defalut action
      End Select
  End Sub
  </code></pre>
  
  <p>Is there any way of doing the above select statement in C# without having to use nested ifs?</p>