Understanding and Creating Classes - Day 2 - Part 3

Sign in to queue

The Discussion

  • User profile image

    Great video bob, it was.....class!. Sorry I had to haha.

    One thing I dont get is when you created the methods. What is {get; set; } all about?


  • User profile image

    @Mintydog: Few things, what bob did is actually a property, not a method.

    Why he did it is called mutator and it is part of encapsulation.  It is one of the concepts of object oriented programming.  You have public and private methods and properties (there are more but I'm simplifying).  Properties have get / set so you can do addtional work when something attempts to fetch or set the value!  This becomes extremely useful in more complex programs.  The get; set; is actually short hand for doing this:

    // short hand
    public int FirstVar { get; set; }
    // long hand
    public int SecondVar
      get { return _secondVar; }
      set { _secondVar = value; }
    private int _secondVar;

  • User profile image

    To make that  more understandable the set can send a value in this case an int (meaning a number value so _secondVar = value you could write _secondVar = 10
    The get returns a value so when you think about it, get means just that, get the value and set means set the value. Note you do not have to do both set and get you can just get the value as you may only want the return value and return means just that return the value i want from the class car to me. So after you get the return value SecondVar you may want to display the result, so in the main class you might have a textbox named mytextbox and you would write , mytextbox.Text = SecondVar and this will display the value in yout textbox.

  • User profile image

    I see the discussion here is good for after the class talk...

    Moreover, I see that a little bit of an issue or problem for absolute begginners is that this might be a little too assuming/accelerated for absolute begginers... I have purchased a C# book so hopefully if I read that for a couple days and then come back to these lessons they might actually make a bit more sense i total.  I feel that at any part I move on... even when i know how to do sometning, that if I do not understand it it is just going to hurt me in the long run...

  • User profile image


    Hello and thank you for this series of
    Thanks a greeting.


  • User profile image

    Thanks and  greetings!

  • User profile image

    This was great!

  • User profile image

    all links are broken

  • User profile image

    Great Video's!

    This is all C# and XAML(Design)..but why it is named Silverlight applications for the Windows Phone 7?

Add Your 2 Cents