Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Understanding and Creating Classes - Day 2 - Part 3

Download

Right click “Save as…”

Practically all work in C# and Silverlight applications involves classes, so in this video we examine the basics of classes, including how classes are defined, their major parts, and how to create new class instances while generally discussing how to work with classes in your applications.

Download the source code in c#

Download the source code in VB.Net

Follow the Discussion

  • 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?

    Cheers

  • Clint RutkasClint I'm a "developer"

    @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;

  • SimSim

    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.

  • 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...

  •  


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

     

  • Thanks and  greetings!

  • This was great!

  • selvaselva

    all links are broken

  • keilkeil

    Great Video's!

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

Remove this comment

Remove this thread

close

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.