Understanding and Creating Classes - Day 2 - Part 3
- Posted: Nov 11, 2010 at 5:45 PM
- 28,634 Views
- 9 Comments
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
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.
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.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?
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
@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;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...
videos.
Thanks and greetings!
This was great!
all links are broken
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