473,386 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

alternate if

hey all,
is there another way to say the following (seems too wordy)

prefix == "TXT" || prefix == "DRP" || prefix == "LBL" || prefix == "CHK" ||
prefix == "UPD" || prefix == "UPC"

thanks,
rodchar
Mar 7 '07 #1
6 976
"rodchar" <ro*****@discussions.microsoft.comwrote in message
news:B1**********************************@microsof t.com...
hey all,
is there another way to say the following (seems too wordy)

prefix == "TXT" || prefix == "DRP" || prefix == "LBL" || prefix == "CHK"
||
prefix == "UPD" || prefix == "UPC"
switch (prefix)
{
case "TXT" :
case "DRP" :
case "LBL" :
case "CHK" :
case "UPD" :
case "UPC" :
{
// do something
break;
}
default :
{
// for any other case
break;
}
}

Also, remember that C# is case-sensitive, so if prefix is "txt", it will
fall through to the default section...
Mar 7 '07 #2
When did they change that then? I'm pretty sure that the C# team didn't
implement switch statement fall through.

http://msdn2.microsoft.com/en-us/lib...7t(VS.80).aspx
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
"rodchar" <ro*****@discussions.microsoft.comwrote in message
news:B1**********************************@microsof t.com...
>hey all,
is there another way to say the following (seems too wordy)

prefix == "TXT" || prefix == "DRP" || prefix == "LBL" || prefix == "CHK"
||
prefix == "UPD" || prefix == "UPC"

switch (prefix)
{
case "TXT" :
case "DRP" :
case "LBL" :
case "CHK" :
case "UPD" :
case "UPC" :
{
// do something
break;
}
default :
{
// for any other case
break;
}
}

Also, remember that C# is case-sensitive, so if prefix is "txt", it will
fall through to the default section...

Mar 8 '07 #3
"Paul Hadfield" <no****@noone.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
When did they change that then?
I don't believe they ever have...
I'm pretty sure that the C# team didn't implement switch statement fall
through.
I'm pretty sure they did...
http://www.csharpfriends.com/Article...x?articleID=46

Have you tried it...?
Mar 8 '07 #4
Have to admit I've not tried recently but all the documentation indicates
that you still can't do case statement fall throughs - even in the article
that you link to it states:

Unlike the C++ switch statement, C# does not support an explicit fall
through from one case label to another. If you want, you can use goto a
switch-case, or goto default.
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:ul**************@TK2MSFTNGP02.phx.gbl...
"Paul Hadfield" <no****@noone.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>When did they change that then?

I don't believe they ever have...
>I'm pretty sure that the C# team didn't implement switch statement fall
through.

I'm pretty sure they did...
http://www.csharpfriends.com/Article...x?articleID=46

Have you tried it...?

Mar 8 '07 #5
"Paul Hadfield" <no****@noone.comwrote in message
news:uo*************@TK2MSFTNGP05.phx.gbl...
Have to admit I've not tried recently
OK...
but all the documentation indicates that you still can't do case statement
fall throughs
Nevertheless...
Mar 8 '07 #6
I don't believe that it's any change.

You can't to a fall through from one case to another when it contains
code, but you can make a fall through when there is no code in the case.

Paul Hadfield wrote:
When did they change that then? I'm pretty sure that the C# team didn't
implement switch statement fall through.

http://msdn2.microsoft.com/en-us/lib...7t(VS.80).aspx
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>"rodchar" <ro*****@discussions.microsoft.comwrote in message
news:B1**********************************@microso ft.com...
>>hey all,
is there another way to say the following (seems too wordy)

prefix == "TXT" || prefix == "DRP" || prefix == "LBL" || prefix == "CHK"
||
prefix == "UPD" || prefix == "UPC"
switch (prefix)
{
case "TXT" :
case "DRP" :
case "LBL" :
case "CHK" :
case "UPD" :
case "UPC" :
{
// do something
break;
}
default :
{
// for any other case
break;
}
}

Also, remember that C# is case-sensitive, so if prefix is "txt", it will
fall through to the default section...
--
Göran Andersson
_____
http://www.guffa.com
Mar 8 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Toby A Inkster | last post by:
www.authoring.stylesheets] For ages I have provided links to alternate stylesheets from my pages as per W3C recommendations: <link rel="stylesheet" href="baz" type="text/css" title="Baz"...
5
by: User | last post by:
If I want to provide alternate stylesheets (eg red.css, green.css), is it better to put all the stuff that is common to both sheets in a separate css file (eg basic.css) and use @import at the top...
1
by: Carl Draus | last post by:
I was reading the FixPackReadme.txt file in preparation for installing v8.1 Alternate FP7. The prerequisites section says that all DB2 processes must be stopped and doesn't differentiate between...
0
by: Jean-Marc Blaise | last post by:
Hi, From version 8.1.2 one can install alternate fixpacks on Unix/Linux. What is the IBM policy on alternate fixpack; is it for temporary testing or can it be permanent in Production ? If I...
4
by: Mark A | last post by:
Trying to upgrade alternate FP9 to alternate FP9a on Red Hat Linux. After running the following command: ../installAltFixPak -y it says it was successful, but no new directory is created in...
1
by: jeffgeorge | last post by:
Using a bit of code to produce alternate line shading in a report. Seems it should work for a form as well but no luck. Does anyone have any ideas what I need to change or if it is even possible...
1
by: Eric Lindsay | last post by:
I am trying to understand the differences between and uses of persistent, default and alternate styles. I have read http://www.w3.org/TR/REC-html40/present/styles.html section 14.3.2 on...
5
by: Michael R | last post by:
Searching the net I've found a simple technique to add row numbers and alternate colors (for the even and the uneven row) to a continuous form. 1st step: Create a textbox, send it to background...
9
by: johkar | last post by:
I need some browser implementation clarification. In the below example, the alternate stylesheet could be invoked by user agents that support alternate stylesheets or by script. Are there any...
0
by: zgh1970 | last post by:
Hi, All, I have some question on the alternate server for the DB connection on db2 connect server. There is one db2 connection to one host database on the server with the following cfg: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.