multiple criteria switch

  • Thread starter Thread starter Emre DÝNÇER
  • Start date Start date
E

Emre DÝNÇER

is it possible to have a multiple criteria switch in C#
switch(name , surname){
case "John","Smith"
break;
}
thanks in advance
 
is it possible to have a multiple criteria switch in C#
switch(name , surname){
case "John","Smith"
break;}

No. If you give us more information about the wider goal, we could
probably help more.

Jon
 
is it possible to have a multiple criteria switch in C#
switch(name , surname){
case "John","Smith"
break;
}
thanks in advance

Well, what sort of behavior do you expect?

In the example you give, you could convert it to something like this:

switch (name + surname)
{
case "JohnSmith":
break;
}

There's no syntax like what you originally proposed, depending on the
exact behavior you're trying to do, it may not be hard at all to
implement using a different syntax.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top