switch(true) in c#



Hi,

In classic ASP with vbscript, I'd sometimes do this.

Select case true
case x = 3
code
case y = 6
code
case r = "tick"
code
End select

In C#, is there a way of doing such a thing? The current code I have that
is /not/ valid is this.

switch(true) {
case sPN!="":
something();
break;
case sPF!="":
//something else
break;
default:
//do something different
break;
}

I know that I could do a few nested ifs, but if there are 10 different
unrelated conditions I want to test for, it could get kinda messy.

Thanks,

Frank


.



Relevant Pages

  • Re: Com error checking
    ... >I have an application that is written in classic ASP. ... As far as VBScript timer functionality goes, at least, it has the Timer ... Windows Script 5.6 Documentation ... you can assume it's hung and avoid calling that sub.... ...
    (microsoft.public.vb.com)
  • Re: C# or VB.NET?
    ... carrying over any of the VBScript baggage... ... have solved a perticular issue in classic ASP" ... During my learning also i've been trying to stick ... I've learnt alot from this ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: C# or VB.NET?
    ... have solved a perticular issue in classic ASP" ... VB or C# to begin learning? ... I would suggest you begin with C#, for no other reason that it will force you to think in an object-orientated .NET way and prevent you from carrying over any of the VBScript baggage... ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Finding block begin/end in VBScript
    ... VS.NET does provide VBScript intellisense in client script blocks as well as ... in server blocks in classic ASP pages. ...
    (microsoft.public.vsnet.ide)
  • Re: Finding block begin/end in VBScript
    ... VS.NET does provide VBScript intellisense in client script blocks as well as ... in server blocks in classic ASP pages. ...
    (microsoft.public.scripting.vbscript)