VB.NET Select...Case Statement Equivalent in C#

Posted by Alex Essilfie on Stack Overflow See other posts from Stack Overflow or by Alex Essilfie
Published on 2010-03-15T12:36:05Z Indexed on 2010/03/15 12:39 UTC
Read the original article Hit count: 278

Filed under:

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?

Select Object.Name.ToString()
    Case "Name1"
        'Do something
    Case "Name2"
        'Do something else
    Case Else
        'Do the default action
End Select

Any help would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about vb.net-to-c#