Click here to Skip to main content
15,907,875 members
Home / Discussions / C#
   

C#

 
QuestionEnumerators In C# Pin
Tee12314-Feb-07 4:30
Tee12314-Feb-07 4:30 
AnswerRe: Enumerators In C# Pin
Colin Angus Mackay14-Feb-07 4:47
Colin Angus Mackay14-Feb-07 4:47 
GeneralRe: Enumerators In C# Pin
Tee12314-Feb-07 5:14
Tee12314-Feb-07 5:14 
GeneralRe: Enumerators In C# Pin
Colin Angus Mackay14-Feb-07 5:25
Colin Angus Mackay14-Feb-07 5:25 
GeneralRe: Enumerators In C# Pin
Ed.Poore14-Feb-07 6:41
Ed.Poore14-Feb-07 6:41 
GeneralRe: Enumerators In C# Pin
Russell Jones14-Feb-07 6:03
Russell Jones14-Feb-07 6:03 
GeneralRe: Enumerators In C# Pin
Tee12314-Feb-07 9:54
Tee12314-Feb-07 9:54 
GeneralRe: Enumerators In C# Pin
Russell Jones14-Feb-07 22:22
Russell Jones14-Feb-07 22:22 
You should be able to do the same thing in both c# and VB. I guess that VB does some sort of auto casting when you try to compare an enum with an int. c# won't do the cast for you but you could do it yourself.

switch(CarType)<br />
{<br />
 case Cars.Honda:<br />
DoHondaThing();<br />
case Cars.Jaguar:<br />
DoJaguarThing();<br />
}<br />
<br />
switch((int)CarType)<br />
{<br />
case 1:<br />
DoHondaThing();<br />
case 2:<br />
DoJaguarThing();<br />
}


Both are syntactically valid but i know which i'd rather be reading 6 months after I coded it. Also if i add an item at position 2 making Jaguar = 3 without changing the second switch statement we could be in trouble.

Russ
QuestionFind location of Notification area(SysTray) [modified] Pin
Russell Jones14-Feb-07 4:15
Russell Jones14-Feb-07 4:15 
AnswerRe: Find location of Notification area(SysTray) Pin
Stefan Troschuetz14-Feb-07 4:33
Stefan Troschuetz14-Feb-07 4:33 
QuestionCreate an entry in the left-click menu of word files Pin
Muhammad Nauman Yousuf14-Feb-07 3:56
Muhammad Nauman Yousuf14-Feb-07 3:56 
QuestionDeploy Font in Windows Application Pin
yesufollower14-Feb-07 3:28
yesufollower14-Feb-07 3:28 
AnswerRe: Deploy Font in Windows Application Pin
sharpiesharpie14-Feb-07 5:29
sharpiesharpie14-Feb-07 5:29 
GeneralRe: Deploy Font in Windows Application Pin
Martin#14-Feb-07 5:40
Martin#14-Feb-07 5:40 
QuestionFTP code Pin
Glau14-Feb-07 3:26
Glau14-Feb-07 3:26 
AnswerRe: FTP code Pin
sharpiesharpie14-Feb-07 4:09
sharpiesharpie14-Feb-07 4:09 
AnswerRe: FTP code Pin
Ed.Poore14-Feb-07 6:43
Ed.Poore14-Feb-07 6:43 
QuestionLooping Pin
Jim Warburton14-Feb-07 3:19
Jim Warburton14-Feb-07 3:19 
AnswerRe: Looping Pin
andyharman14-Feb-07 3:27
professionalandyharman14-Feb-07 3:27 
AnswerRe: Looping Pin
tarasp14-Feb-07 3:44
tarasp14-Feb-07 3:44 
AnswerRe: Looping Pin
tarasp14-Feb-07 3:48
tarasp14-Feb-07 3:48 
AnswerRe: Looping Pin
Luc Pattyn14-Feb-07 7:43
sitebuilderLuc Pattyn14-Feb-07 7:43 
Questionhow to get first 5 records from a dataset having 100 records Pin
romanchita14-Feb-07 2:33
romanchita14-Feb-07 2:33 
AnswerRe: how to get first 5 records from a dataset having 100 records Pin
Matglas14-Feb-07 2:41
Matglas14-Feb-07 2:41 
AnswerRe: how to get first 5 records from a dataset having 100 records Pin
ednrgc14-Feb-07 2:43
ednrgc14-Feb-07 2:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.