C# Fundamentals: Development for Absolute Beginners

Declaring Variables and Assigning Values Duration - 05

Download this episode

Download Video

Download captions

Download Captions


In this lesson we start adding C# syntax to your vocabulary by talking about one of the fundamental building blocks: data types and variables. As well as basic topics such as naming conventions, data type conversions are discussed.


 Download the source code for Declaring Variables and Assigning Values Duration


C#, Visual Studio



Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • santi

      Just awesome, I recomend this to more people. Keep up good work in C#

    • SimonMcGuirk

      Seem to be having a bit of trouble running the int.Parse(y); code.

    • BobTabor

      @Scimac ... Did you figure this out?  Need some help?

    • SimonMcGuirk

      @BobTabor:Yeah the error was between the keyboard and chair as I forgot to edit the variable assignment so I was trying to parse my name to an int. D'oh! I can move on now Big Smile

    • chriax

      Excellent vids bob, I hope these can fix my extremely poor education with programming Smiley

    • hasan

      @bobTabor ..Sir you are great ..such a nice way, sir please if you could teach OOP in same simple manner then it would be so great , and we student specially will be grateful to you

    • Albert

      I just wanted to say that I love the videos, you are doing a FANTASTIC job at it.

      Thank you:)

    • BobTabor

      @chriax, @Albert : Thank you!  Glad you enjoyed the series!


      @hasan: I go into much more depth on my own website ... see the URL at the beginning of each video.  Hope that helps!

    • Akeel

      good work..thanks..

    • duhduhdan

      Great work! I'm really learning a lot, this is exactly the kind of series I was looking for to start learning the fundamentals of C#!

    • creamweasel

      Just wanted to take the time to share the love, Bob, like others here. This tutorial series is quality. Great pacing and clear delivery; good job!

    • BobTabor

      @AkeelMadduhduhdanMadcreamweasel: Thank you, thank you, thank you!  Smiley  I appreciate the nice notes.

    • thens

      @BobTabor: Thank you so much Bob, your videos are very easy to understand Smiley

    • Cooper

      ERRRgghh... why Silverlight... I guess I will just have to download them instead. If you want to play videos from the very begining and not skip along slightly or skip at all for that matter that don't even bother! Great content ruined by a nasty plugin that doesn't appeard to have matured enough to be useful yet.


    • BobTabor

      @Cooper: Sorry Cooper ... I'm not sure what happened but these videos seem to pose a problem for some users.  I would recommend downloading to your local computer to view.  Again, sorry for the issues you're encountering!

    • Alvin

      Hey Bob! Im taking a c# course and your videos are helping me alot. Are there any books you may recommend that will improve my coding syntaxs?

    • Ravikumar

      Hello Bob,

      It's an amazing work.

      Is there any way to maximize the video size.With the current size it's bit diffficult to follow.Unless we download the videos..i unable to maximize.

      Thanks in advance.

    • Sean

      Just wanted to say
      Console.WriteLine("Thank you Sir BOB");

    • antisocial

      one question thou --  the "To?????"  conversion instructinos and the "PARSE".  how do they compare whats the difference and which is more afficient.  excuse the spelling esl - lol...

    • BobTabor

      @Alvin: I think I make a few recommendations at the very end of this course.  Good luck!

      @Ravikumar: I'm pretty sure there's a little button in the lower-right hand corner of the player that will make the video go full screen.  Just doing this from memory.  Hope that helps?

      @Sean: Funny.  Smiley  Thanks!

      @antisocial: Well, two things ... First, check this out:


      Second, efficiency is the last thing I would worry about in application development.  Not saying you should never worry about it, but it is literally the final thing you would concern yourself with, having bench marked performance, then running tools to determine where the bottlenecks are.  You shouldn't make presumptions about performance prior to having real metric to judge against.  Hope that helps!


    • Khaya

      Hi Bob, I've been browsing through your videos and they're awesome but I'm running into trouble downloading the Visual Studio C# 2010 IDE?
      I'm able to download the setup file but when I tries to download the installation file, it gives me an error message and states that it cannot reach the server. Is it a proxy issue because I use my office computer which is subject to a firewall and proxy?

      Please advise because I'd love to follow properly with Visual Studio open in front of me.


    • BobTabor

      @Khaya: That is quite a pickle.  Search for a download link -- NOT the Platform Installer, but the FULL INSTALL for Visual C# Express Edition.  That way you can eliminate the firewall / proxy from consideration.  I'm sure the good folks at the Web Platform Installer team would want to hear about this ... you may want to reach out to them in the Feedback link in the footer of this website. It will get forwarded to them ... perhaps they can better diagnose.  Hope that helps!!!

    • sachin

      awesome one
      bob i m ur fan when i watched ur video of vs 2005 ur explanation are awesome as you are....

      thanx a lot keep it up

    • Ameer Ali

      bob me disappointd the videos are not working means too if i want to watch these videos online then thse are tooooo slow and if i want to download on my pc then these are not in clear for watching plz any suggestion

    • BobTabor

      @sachin: Ah cool.  Yeah, that seems like a lifetime ago.  Smiley

      @Ameer Ali: I think either (1) you need to update the Silverlight plugin for either streaming or watching locally, and/or (2) you need to use the MP4 version of the file download (above).  That should fix your problem.  Good luck!!!

    • Raphael

      Hi Bob.
      I have followed all of your videos until this one (I'm actually going through the whole series)...
      My hello world application worked very well, but when the time came to write this application, when I ran it in debug or in a built release, the window just flashed (opened and closed itself very very quickly, not giving me a single error or anything).

      What's the matter? My Hello World application could stay open for a while until I hit the enter button... but this one seems to act by itself. I verified my code and everything seems to be the exact same thing as you... I haven't even messed with any options so I don't know what could cause this to happen :(

    • Raphael

      Oh my... Sorry about this Bob! Silly me... I had Console.WriteLine two times in a row instead of Console.ReadLine on the line 18!!! hahaha

      Sorry about that :)

    • BobTabor

      @Raphael: Glad to hear you got it worked out.  Sometimes just explaining the problem to someone else is enough to trigger the solution in your mind.  Good luck!


    • Vlad

      You explain this stuff very well. I learned C++ in Highschool so I know the basics like data types, variables, arrays, matrix, struct, for, if else, while, do, graphs... some methods like Divide et Impera, Backtracking etc but I want to get on C# and .NET so this series is very helpful. Thanks!

    • Babblu

      Hello Bob,
      your videos are simply superb.....

    • bouzid

      please help me I dont understand why I can not compile this simple program
      class Program
      public static int MultiplyBy4 ( aNumber int );
      return 4*aNumber;

      public static void Main()
      int x=4;
      int result=0;
      Console.WriteLine (" your value is {0}",result);

    • BobTabor

      @bouzid: A couple of things ... I think your curly braces are in the wrong spots ... so:

      class Program
        public static void Main() 

      Also, you are returning 4*aNumber; ... however you can't perform this type of statement outside of a method declaration.  Only fields, property and methods can live directly inside of a class. 

      I would recommend you keep watching through lesson 10 ... these types of things will be discussed in more detail.  You're on the right track!  Just need to get a few specifics under your belt.  Good luck!

    • George

      Hey Bob, Great videos, I'm finding these extremely helpful as i have been trying to get into programming and you are the only person i've found that doesn't make the assumption of previous experience.

      Being only 15 I have no experience whatsoever apart from basic HTML knowledge. You really explain everything well and not once have i been frustrated with the code because you go through the possible mistakes that have been made and tell you how to fix them.

      great work and thank you for making these :).

    • Justin B

      There is one thing I don't quite understand...

      When you write the lines:

      console.writeline("Which door will you choose 1, 2, or 3?");
      string uservalue = console.readline();

      I understand that console.writeline will command the console to display the text "Which door will you choose..." However, I don't fully understand what console.readline is or what it does when it is being used to give value to a variable. Actually, now that I think about it, I don't even fully understand why we use the command "console.readline"

      Could you bring clarity to my thoughts please?
      It would be most appreciated.
      Thank you.

    • SenCan

      Bob, I am a lifetime student, I think you are a Master teacher.

    • Mohd

      Bob your are excellent as much as your look and may your health and knowledge blooming accompany you wherever you go not forgetting your crew behind though.
      Your VT has been very helpful to me and many more people likewise.
      You know something Bob when you spend knowledge to people it will grow
      but not money.

    • Martin

      Hi I've been trying to copy out the coding but cannot read the first part, does it say Svt?

    • Darrell

      Hi there Bob. Your tutorials are fantastic! You've really inspired me to dive in and start creating.

      Thanks a ton!

    • Brogan

      A bit confused here. Something seems to be working that shouldn't. Going from ~17 minute mark in the video the following should result in an error:

      int x = 7;
      string y = "Brogan";
      string myFirstTry = x + y;

      string y2 = "5";
      string mySecondTry = x + y2;


      The above doesn't result in an error, but simply displays '75' on the console window. I have the exact same version of the .NET framework that Mr. Tabor is using (4.0.30319) and I'm using Visual C# Express 2010. The only difference is that I have XNA Studio installed alongside the base Visual C# Express application.

      It's not really a problem, I'm just a bit curious why it appears as though this code results in a string and not a build error like in the video.

    • Duncanma

      @Brogan: I think you just made a slight transcription error on the code that causes the error in the video. That code was more like this:

      int x = 7;
      string y = "Brogan";
      string myFirstTry = x + y;
      string y2 = "5";
      int mySecondTry = x + y2;


      Note that mySecondTry is an int, not a string. String works, because (as Bob explains in the video) it is essentially doing...

      x.ToString() + y2; 

      But you can't do a conversion from a string, or from the concatenation of two strings, into an integer. If you truly wanted the combination of 7 + 5, you would need to do this:

      int mySecondTry = x +  int.Parse(y2);

      This only works because y2 is a number, if it happened to be "Bob" or "Brogan", then int.Parse would throw an error.


    • Cristian

      First of all, I would like to say thank you for everything. I started watching these series in late October 2012 and it was one of the best things to happen last year. I think your tutorials are very well explained, well a bit annoying some times but it's a good thing.

      I am now coding a Client Server application. More exactly, a game. Certainly not one of those popular games, but it is a good way to learn more about C# and TCP.

      Thank you again. I could have made it without you.

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.