Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

C# Programming Video Tutorials Lesson 4: Switch Statements

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
8,287
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Jan 30, 2009

HQ Download and Source Code:
http://www.mediafire.com/file/jhitatiwkwy/Lesson4.rar

Youtube's HQ Link:
http://www.youtube.com/watch?v=7VT2aUE7_Lc&fmt=18

A switch is used when a certain set of specific choices is offered to the user. Works similarly to if statements, more is explained in the tutorial. Switch statements use "cases" to represent the different events that could occur. A switch then decides whether any of the "cases" match, then executes the code within the case block.

Category:

Howto & Style

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (babyyoyoboy)

  • thanks mate, you have saved me, and your probally going to quite alot today with this piece of programming i have got to do

  • @blackmage0 Just message me if you need more help :P

  • you just fixed my entire program by showing me the conversion lol. thanks

  • im glad i could help

  • if you ant to change the color and add A title here is a few tips

    ok first you add this source above

    int myInt;

    Console.Title = "YOUR TXT HERE");

    Console.ForegroundColor = ConsoleColor.Red;

    Note you can also use Blue,Green,DarkGreen and mant other colors

  • First off...

    int myInt; right there is worthless...

    Second...

    Console.Title = "YOUR TXT HERE"); would cause an error because there is a random )

    The 3rd line you provided would compile but you didn't provide any specifics about how the line works...

see all

All Comments (22)

Sign In or Sign Up now to post a comment!
  • thanks ive been searching for a way to convert int to work with switches, but i was trying to use a string then back to int.

  • You don't need to put break, unless you don't want a fall through effect

    You can also put default anywhere not just the bottom

    Consider this:

    for default and condition A you want statements X, Y and Z

    for condition B you want statements Y and Z

    for condition C you want statement Z

    then you could do:...

  • Thanks for this and all other videos. Free knowledge at this convenience is seriously awesome. I really appreciate everyone who does this stuff.

  • The C# language is 10000000000times easier the C language

  • I dont understand what the Convert.ToInt32 means...... what does the 32 mean??

  • By far the best C# instruction out there!

    I'm working in Expression Blend and VS and have to load a dynamic url into the MediaElement of an silverlight media project I'm doing. I'm usiing C# in the code behind. Know anything about how to do that?

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more