473,395 Members | 1,554 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,395 software developers and data experts.

c# equivalent to select case true

TS
i used to do this in vb and haven't been able to in c# - any workaround?
Nov 17 '05 #1
5 3745
Show us a code sample in VB what you want to do.

As a guess, you're not talking about the switch keyword, are you?

"TS" <ma**********@nospam.nospam> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
i used to do this in vb and haven't been able to in c# - any workaround?

Nov 17 '05 #2
switch(myvariable)
{
case "blah":
return;
default:
return false;
}

--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.masterado.net

"TS" <ma**********@nospam.nospam> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
i used to do this in vb and haven't been able to in c# - any workaround?

Nov 17 '05 #3
TS wrote:
i used to do this in vb and haven't been able to in c# - any workaround?

switch (true)
{
case 1:
break;
default:
break;

}
Nov 17 '05 #4
"TS" <ma**********@nospam.nospam> schrieb im Newsbeitrag
news:uB*************@TK2MSFTNGP15.phx.gbl...
thanks, yes i am looking for a
switch(true)
{
case var1 = 5 : ...
case var9 = 21: ...

i guess you can't do it as i thought

<snip>
you can:
the c# equivalent is:

if (var1 == 5)
{
.....
}
else if (var9 == 21)
{
......
}
........
Nov 17 '05 #5
TS
thank you all, thats what i thought!
"Christof Nordiek" <cn@nospam.de> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
"TS" <ma**********@nospam.nospam> schrieb im Newsbeitrag
news:uB*************@TK2MSFTNGP15.phx.gbl...
thanks, yes i am looking for a
switch(true)
{
case var1 = 5 : ...
case var9 = 21: ...

i guess you can't do it as i thought

<snip>
you can:
the c# equivalent is:

if (var1 == 5)
{
.....
}
else if (var9 == 21)
{
......
}
.......

Nov 17 '05 #6

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

Similar topics

3
by: Iain Hallam | last post by:
Hi. I've been using display:none on the style property of some <option> elements in my forms, which works fine with Mozilla - as expected it removes the option from my dropdown (although it...
24
by: hjbortol | last post by:
Hi! Is the expression "a >= b" equivalent to "a - b >= 0" in C/C++? Is this equivalence an IEEE/ANSI rule? Or is this machine/compiler dependent? Any references are welcome! Thanks in...
2
by: JMCN | last post by:
hello i have your basic select case question. i created a combo box and save it as a query. so whenever the user selects the value and clicks the export button, the select case should then export...
5
by: DaaaDaaa | last post by:
Hi, Here's what I'd like to do: table (Orders) has fields of Processed, Paid (both of boolean yes|no) etc, I want to return a count of of Total number of Orders, Number of Processed vs. Number...
4
by: Hai Nguyen | last post by:
I'm learning C sharp and do not like vb much. I'm creatiing a wepage using panel to test myself. I tried to use these code below, which is written in VB, and to transform them to c sharp but I got...
3
by: Will Chamberlain | last post by:
I have looked around and found the equivalent for IIF (Access) to be a SELECT CASE in SQL. I have tried this with no success. I am also looking for the equivalent of MAX and have had no luck. The...
1
by: microsoft.public.dotnet.languages.vb | last post by:
Hi All, I wanted to know whether this is possible to use multiple variables to use in the select case statement such as follows: select case dWarrExpDateMonth, dRetailDateMonth case...
1
by: The.Daryl.Lu | last post by:
Hi, two parts to my problem if someone can help address either one or both: 1. I want to SELECT everything in the table if it matches the criteria when the query button is pressed (this is just...
21
beacon
by: beacon | last post by:
Hello to everybody, I have a section on a form that has 10 questions, numbered 1-10, with 3 option buttons per question. Each of the option buttons have the same response (Yes, No, Don't know),...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.