Switch with or

C

Champika Nirosh

Hi All,

How can I do some thing like this in c#?

switch (value)

{

case ("decimal" || "numeric"):

{

_Type = "decimal";

}break;

}

Thanks,

Regards,

Nirosh.
 
C

Chester Ragel

switch (value)

{
case "decimal":
case "numeric":
{
_Type = "decimal";
break;
}
}

Chester
 
A

Adam Clauss

Champika said:
Hi All,

How can I do some thing like this in c#?

switch (value)

{

case ("decimal" || "numeric"):

{

_Type = "decimal";

}break;

}

Thanks,

Regards,

Nirosh.
You should be able to do something like:

switch (value)
{
case "decimal":
case "numeric":
_Type = "decimal";
break;
}
 
C

Champika Nirosh

Thanks Adam

Adam Clauss said:
You should be able to do something like:

switch (value)
{
case "decimal":
case "numeric":
_Type = "decimal";
break;
}
 

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

Top