C# Classes Tutorial | Mosh

  Рет қаралды 288,852

Programming with Mosh

Programming with Mosh

Күн бұрын

Пікірлер: 118
@olekristianrannekleiv762
@olekristianrannekleiv762 2 жыл бұрын
Finally a programmer who does not suffer from "its obvious" syndrome and accually explain all the small details, point out what can be ignored for the moment and repeats the small details over en over at any oppourtunity to remind the viwer and not overwhelm him/her.
@xeakpress
@xeakpress Жыл бұрын
FAM I KNOW WHAT YOU MEAN. Like I'm watching a TUTORIAL video. If it was 'obvious' I wouldn't be watching the video
@syedameerhussainkazmi918
@syedameerhussainkazmi918 6 жыл бұрын
I gave this dude a subscribe just because he said its perfectly fine if we dont want to register for his course, seems to me like not only is he a great teacher but also a humble person. Good on you mate
@HarryPotter-nc6yl
@HarryPotter-nc6yl 5 жыл бұрын
6:34 (copy pasted from net) The main limit is that C# only lets you use var for local variables (inside a function). Your class members must have explicit types. In your case, it looks like you want this:
@poloska9471
@poloska9471 4 жыл бұрын
For anyone having trouble figuring out how to make the cmd window stay open when running the program: [Option 1]: Top-Most FileMenu -> "Debug" -> "Start Without Debugging" [Option 2]: Press Ctrl+F5 (Note: you might have to press [Ctrl + fn + F5] or it will open menu instead of executing... depends on your keyboard) Cheers.
@XXIcenturyblood
@XXIcenturyblood Жыл бұрын
0:26 - What is a class? 0:50 - Real world example 2:22 - Anatomy of a class 3:46 - Object 4:32 - Declaring classes 6:35 - Creating objects 7:21 - Using objects 7:32 - Class members 8:15 - Why use static members? 8:52 - Declaring static members 9:06 - Demo
@eugenekim2477
@eugenekim2477 6 жыл бұрын
He lost me at the parse section. Parse wasn't even reviewed at least enough to understand the last example... Struggling to understand this section.
@crabsynth3480
@crabsynth3480 6 жыл бұрын
Its definitely a tough example for beginners and surely feels out of place. Its basically showing you a wrong way to do it first and then correcting it... which might not have been necessary here and is rather confusing and there are easier explanations of Static keyword... Parse is a completely custom function here... so you don't have to associate it with the default Parse functions. I know its a little bit hazy but the entire point is that we want to move the person.Name line inside a static Function so that 1. We don't have to manually assign it in the Main program every time and 2. We don't have to instantiate a Person Object (person) to call it's Parse function only to store its output result (of type Person) inside another manually created Person Object(var p)
@Coouge
@Coouge 6 жыл бұрын
Eugene Kim I was gonna type exactly what you said. I got confused when he started using *Parse*
@renatoloefstop
@renatoloefstop 5 жыл бұрын
I was gonna say the same thing.
@버튜버봄-s9e
@버튜버봄-s9e 4 жыл бұрын
Mosh does not even tell you that 'it was just for using static lol I'm making the code a bit longer just to use static but i won't tell you why i made the code longer unnecessarily just to use static. all you have to do is watch the next video'
@버튜버봄-s9e
@버튜버봄-s9e 4 жыл бұрын
11:58 -> 13:33 this is a shit of unnecessities.
4 жыл бұрын
No one can visually clearly explain all these hierarchies - a lot of talks, code does not make less confusion. Although I understand it more, but I listen as a newbie and hear all the reasons for confusion. Lecturers should try to make this understandable for 8yo kid - and it could be achievable.
@josegarcia2762
@josegarcia2762 Жыл бұрын
Languague barrier
@Dante3085
@Dante3085 6 жыл бұрын
6:02 You went over the method return type with you'r mouse while saying "Signature". I am not sure if you meant to say that the return type is part of the method signature, but just to eradicate any confusion, the method return type is definetly not part of the method signature !
@joeMsessions
@joeMsessions 4 жыл бұрын
With the "Parse" method, aren't you just making a constructor in a roundabout way here? Am I missing something? Seems like a pretty unconvincing example of why I'd want to use a static member. (Mosh, btw, I've bought a few of your Udemy courses, and love them. Did them at the start of my career and I'm two years in now. Thank you!)
@nogamesnofame
@nogamesnofame 3 жыл бұрын
Goddamn, I finally found a youtuber whos voice does not bore me and teaches what I'm interested in!
@chelebarry
@chelebarry 6 жыл бұрын
It was a bit troublesome for me to understand that final 2 min of the videos still wrapping my head to understand well how the method in a class interact. I will see your other video on methods hope this clears things up.
@footballCartoon91
@footballCartoon91 4 жыл бұрын
Actually the static function inside a class outside program is a good example. Because we cannot create object in the main function, So we create an object inside the class
@gokumetrix80
@gokumetrix80 5 жыл бұрын
I am still struggling to understand this.
@B18CdelSol96
@B18CdelSol96 4 жыл бұрын
At the end he explains it quite badly
@B18CdelSol96
@B18CdelSol96 4 жыл бұрын
Lol this was made year ago
@gokumetrix80
@gokumetrix80 4 жыл бұрын
@@B18CdelSol96 still dont understand it 😭
@anzerupnik1442
@anzerupnik1442 Ай бұрын
Found this because I was learning for snytax of C# (I have some C++ exeprinece). I like that the tutorial explains the concepts of classes.
@adukaleerjook9299
@adukaleerjook9299 6 жыл бұрын
Great and humble of online programmers I am not a computer science but I am just watching yours for well arrange clear explanation..I subscribe..
@josphatoluoch5205
@josphatoluoch5205 4 жыл бұрын
Thanks a lot, You are changing the world bro!! :D
@dannycisco5721
@dannycisco5721 2 жыл бұрын
I really want someone to explain the Person vs person step in a way that locks in it. A beginner's example with a different word for each would really help.
@91bravic12
@91bravic12 2 жыл бұрын
I think what your asking is when he did Person person. This is just like setting a variable and calling "string name = "steve"; name then has all the benefits of the methods of string. Person person creates and object (kind of like a variable) which then has all the methods or whatever in the class Person. Hope that helps some, might of been better if is wasn't called Person person, but something like Person student.
@ko3li668
@ko3li668 5 жыл бұрын
I just started learning programming for a month now! (C and C#) I'll keep learning until the end of days. I'll be answering questions about "Where am I now at programing?" after 9 months from now! cya
@Nothingtosee55
@Nothingtosee55 5 жыл бұрын
C# is a little old nowadays learn python is really easy and good
@ko3li668
@ko3li668 5 жыл бұрын
@@Nothingtosee55 I'd love too! But right now I need C# for my studies. For what I've seen so far I really cant wait for the moment when I start learning Python but for now I need to focus on C#, C, JavaScript to get my diploma.
@zakaria4988
@zakaria4988 4 жыл бұрын
@@ko3li668 C# is still a good programming language, if you master C# and JavaScript you're at the top. You can make Web Apps, Mobile apps, Desktop Apps, Machine Learning and Cloud stuff
@ko3li668
@ko3li668 4 жыл бұрын
Update: I now learning Asp.net core. I am now able to make web sites and web applications. I've come so far since my comment here! I now got more comfortable learning .Net as a whole. Baby steps but I am getting there. From stumbling on this video for the first time looking for someone to explaining to me what is a Class to me now using Asp.net core, Entity framework core, SQL, Html, Css, Bootstrap and JavaScript to build my first web application! Man, if I can do it then you can do it too. I'll come back to this comment in 2021 August. I'll update you on where I am on the road of becoming a FullStuck web developer.
@DiorisArias
@DiorisArias 4 жыл бұрын
@@ko3li668 Loving your comment. If you were able to achieve all that within 7 months, it really makes other beginners feel more motivated
@brandonnorris1026
@brandonnorris1026 4 жыл бұрын
Made me believe that I could use var to call a Class from anywhere on earth.
@dannycisco5721
@dannycisco5721 2 жыл бұрын
As a beginner I was totally thrown by the string[] in the Main()... being shown examples of more confusing ways to give the same result is the best way to make my brain switch off. My brain just says "Parse? Why?"
@Tbone272
@Tbone272 2 жыл бұрын
thanks for the videos, planning taking your course after I get through all the free stuff. Just trying to maximize exposure as much as I can. Thanks for giving both options.
@VisibleWater
@VisibleWater Жыл бұрын
very nice explanation, thank you very much.
@tko9753
@tko9753 6 жыл бұрын
I’ve watched several tutorial about C# and I understand everything until I reach methods, classes and instances and then I got lost, I couldn’t understand anything. This is really frustrating
@ronancasey
@ronancasey 7 жыл бұрын
You're a great teacher :)
@jasiantheasian8894
@jasiantheasian8894 4 жыл бұрын
Tldw: Person person person
@hs_infotech
@hs_infotech Жыл бұрын
Hello Sir, can you please tell me your visual studio customize settings. auto fill syntax settings like example you type cs = console.write() something like that and some more extra features you used like in class void Main the different color shows in Main tag like that and many more. Can you help.
@marsa0999
@marsa0999 6 жыл бұрын
7:00.... how is “Person person” camel case when you described it as “camel Case” in 5:00? And it seems like it does not match “Pascal Case” either?
@IvyTeaRN
@IvyTeaRN 6 жыл бұрын
person is the name of the variable. Its not a function or whatnot
@upya3813
@upya3813 5 жыл бұрын
Please, if I'm wrong about this in any way, CORRECT ME! - "Calling" and "Naming/Declaring" are two specifically different ideas/concepts... or "THINGS". for example: "Person(1) person(2)" 1) Is Calling The Class "Person" - Named As Such (Pascal) When It Was Created (As A New Class). It Is "Calling'' As It Refers To An External or Separate File (Method) Other Than The Page You Are Currently Working In. = PascalCase 2) Is DECLARING the INSTANCE of the above described, simply NAMING Person(1) arbitrarily as "person" - As you might CALL the above method several times on this current file/page ie. person1 / person2 / person3 / person4 / etc... = camelCase That is to say, ANYTIME you're referring to an Existing/Outside Class/Object or you're creating a NewClassFileToLaterReferTo (Let's Say: Method_X) = use Pascal. If you are simply giving a label to a single instance of (Method_X) when actually calling/referencing to it = use camelCase --Common convention is to prefix with "_underScore" when implementing PRIVATE methods, I believe. --Hope that helps everyone who might be stuck here. Again, correct me if I'm wrong :)
@yakuppala9130
@yakuppala9130 5 жыл бұрын
There is an error on last code Error CS1656 Cannot assign to 'Introduce' because it is a 'method group'
@donfeto7636
@donfeto7636 7 жыл бұрын
want video about the arg and how to use them what there important like casting a buttom buttom bt=(sender) buttom what this mean !
@gogl0l386
@gogl0l386 5 жыл бұрын
You said person so many times so now it doesn't even sound like a word.
@quickregisterseo
@quickregisterseo 5 жыл бұрын
I purchased his c# course. The version of Visual Studio has nothing to do with the current version. It is so different you cannot follow along. Nobody responds on forums. Waste of money.
@misterbristles
@misterbristles 5 жыл бұрын
I have not purchased his course, but I would suggest rolling back to the previous version of VS.
@jz9991z
@jz9991z 5 жыл бұрын
You said classes can be referred as objects. So is that what object oriented programming is about?
@ayemzu888
@ayemzu888 Жыл бұрын
i copied the code of the program written in first method line by line into visual studio and it has 17 errors, 1 warning and doesn't work at all. why is that? have visual studio/ c# changed so much?
@codaq4043
@codaq4043 6 жыл бұрын
is it safe to say an identifier, if not a keyword, is just like a label you can use to organize?
@Osamah001
@Osamah001 5 жыл бұрын
short answer __ class Person {~~~} public Person() {~~~}
@brandonnorris1026
@brandonnorris1026 4 жыл бұрын
Its a good tutorial but it is absolutely not for beginners like myself.
@rohankumbhojkar6803
@rohankumbhojkar6803 4 жыл бұрын
Once you master oops concepts then becomes fairly easy.
@upya3813
@upya3813 5 жыл бұрын
hey Mosh another outstanding vid! - just err... what they heck did you double tap (key or click?) to have the on screen helper pop up to make {0} and {1} suddenly appear in green (outside string and into the Main array?) --- I've missed that small little but and Im stuck at this point now! Rushing to complete an assessment so any help is appreciated! Thanks in advance
@eruptor2222
@eruptor2222 5 жыл бұрын
Mosh uses several external plugins/addons (paid/unpaid) that can make his coding easier to do. One of which is that highlighting affect on certain keywords ect..
@upya3813
@upya3813 5 жыл бұрын
@@eruptor2222 Thanks so much for that! Does Mosh also have a video where he showcases or recommends these plugins prior to doing these free courses he provides? You'l appreciate this particularly hard to locate among the plethora of amazing vids on his channel so if you've seen one before please share a link? In good faith, I'll pay it forward! :) Cheers again!
@misterjack347
@misterjack347 5 жыл бұрын
You are best tutor ever bro.
@wuyanchu
@wuyanchu Жыл бұрын
thx and god bless you ^_^
@ulkalobo9566
@ulkalobo9566 4 жыл бұрын
The last one person object using parse method didn't understand? Can u please elaborate
@johnconnor9787
@johnconnor9787 5 жыл бұрын
now I understand what static methods are for
@bytiran7041
@bytiran7041 4 жыл бұрын
@G BBarn and yours? do you still programming?
@sanakabbani2865
@sanakabbani2865 4 жыл бұрын
@@bytiran7041 lol
@dejoneltahan1974
@dejoneltahan1974 2 жыл бұрын
what the use of public string name
@prameelasekhar
@prameelasekhar 4 жыл бұрын
public void Introduce(string to) { Console.WriteLine("Hi {0}, I am {1}", to, Name); } Can anyone explain 'to' here ? How it getting Name 'John' in the result ?
@benzel5659
@benzel5659 4 жыл бұрын
When you call the method "Introduce" it takes a parameter, which is the person you're introducing yourself "to". It is a weird way to name a parameter. It would be more sensible to go: public void Introduce(string OtherPersonsName) { Console.WriteLine("Hi {0}, I am {1}", OtherPersonsName, Name); } where {0} = Other persons name ... and {1} = Name (your name)
@lastofthesarcastic7682
@lastofthesarcastic7682 4 жыл бұрын
I can't find the C program he uses, when I download c for Windows Im missing certain options on my top right corner like : properties, references etc, any help?
@gulwantharmeensoond5792
@gulwantharmeensoond5792 4 жыл бұрын
he is using vs.net environment to code which is a software development IDE by microsoft for .NET framework
@themixedvoices5390
@themixedvoices5390 3 ай бұрын
I can't get parse thing can someone pls explain
@clashkingdom3647
@clashkingdom3647 5 жыл бұрын
Amazing vedeos Mosh but please help me explain about parse in method because i am new to C# ,please help me because i didnt understand it thanks keep it up bro
@SuperOnlyP
@SuperOnlyP 5 жыл бұрын
He just wants to focus on making an example of static method by using Parse method to get return value. when you get practice more you will understand Parse method is like Convert a String to a Number.
@mohamadayman514
@mohamadayman514 6 жыл бұрын
Could it be possible if console . writeline was written like this (System. Console.WriteLine ( );?
@setyoufree2726
@setyoufree2726 5 жыл бұрын
@daniel halachev - other way to short the writing, put in very beginning: using static System.Console; Then we can write just: WriteLine.. without Console.WriteLine()
@chanlito4896
@chanlito4896 7 жыл бұрын
Hey Mosh what’s the point of learning c# when you’re a full stack js dev? Could u give me your point of view?
@soufianedasmiress7788
@soufianedasmiress7788 7 жыл бұрын
for making games or apps as example
@tyrellwreleck4226
@tyrellwreleck4226 6 жыл бұрын
C# is a java-like alternative for using .NET . Very much different from js so practically you can't utilize .NET by other non-agnostic language let alone js
@shamardinkhan1622
@shamardinkhan1622 4 жыл бұрын
i like your teaching method and i follow you but sir i can't fort money to take your online C# classes so please sir upload you that classes here on youtube
@aaronjohnson2215
@aaronjohnson2215 5 жыл бұрын
Why oh why, can someone explain to me why the construction is Person person = new Person() ?? I'm loosing sleep because of this. Can this variable be of different class once declared as = new Person() ? Or once declared as variable of class Person can it be something else after the = symbol? If yes then I can understand this construction, otherwise wtf? And for the sanity of new learners' sake: use different names for variables and differentiate names in general instead confusing the shit out of ppl with Person person = new Person(). Better would be Person_cls person_var = new Person_cls, at least this is showing these names are not related (not so obvious for beginners).
@desmondcayce
@desmondcayce 4 жыл бұрын
bruh its not that hard, maybe ur stupid
@aaronjohnson2215
@aaronjohnson2215 4 жыл бұрын
@@desmondcayce Maybe you learn how to function in society and put your point forward politely.
@kazz8176
@kazz8176 4 жыл бұрын
I'm literally 16 years old how am I supposed to understand something that I never heard about like Parse
@nullreferenceexception1448
@nullreferenceexception1448 4 жыл бұрын
Age has nothing to do with that
@bsh7390
@bsh7390 4 жыл бұрын
I am only 9, how am I supposed to know what is Parse
@percheronphenom
@percheronphenom 5 жыл бұрын
His beginners course was great, but here I am just overwhelmed, Visual Studio makes the code looks colorful but it just doesn't make much sense with repeating names of this and that and what the hell are we all doing :|
@eruptor2222
@eruptor2222 5 жыл бұрын
Are you talking about the "Person person" part used in the code? If so, let me explain. Person is the name of the class, so when Mosh says: Person person = new Person(); what is happening is that he is creating a Person object, with the name "person" simlar to how you name variables. The "= new Person();" part of the code is intialising this object. It will also invoke any code you have in the constructor of the class. If you're unsure what constructors are, have a quick google. Effectively it is code within a class that runs on the creation of an object of that class. If you need more explanation just say :)
@onon128
@onon128 4 жыл бұрын
Didn’t understand anything
@javiers.8274
@javiers.8274 4 жыл бұрын
He lost me at the parse section too..
@Hephasto
@Hephasto 5 жыл бұрын
Fuck, seems so complicated to me! I must be very stupid if I still don’t figure out such basic things as a simple class
@AGUNGKAYA
@AGUNGKAYA 3 жыл бұрын
try python. Programming language is a choice. Not everyone is suitable in certain programming language.
@Hephasto
@Hephasto 3 жыл бұрын
@@AGUNGKAYA actually I tried and indeed it worked better for me
@jeremychu8922
@jeremychu8922 5 жыл бұрын
person is just a varible in the code.
@redstoneguy9248
@redstoneguy9248 3 жыл бұрын
2:20 did anyone else see that volume thing
@ndost2009
@ndost2009 6 жыл бұрын
It is like reading an encyclopedia; be less monotonous
@shamardinkhan1622
@shamardinkhan1622 4 жыл бұрын
i am belong to very poor family so please kindly upload that lectures here
@macsoccer2012
@macsoccer2012 2 жыл бұрын
How did you afford to write this comment then
@maxwellsmith9988
@maxwellsmith9988 4 жыл бұрын
This doesn't fuckin work for me at all
@64imma
@64imma Жыл бұрын
So basically instead of spending money on your udemy course, I could have just watched your KZbin videos for free?
@gautambhatia479
@gautambhatia479 4 жыл бұрын
1
@dejoneltahan1974
@dejoneltahan1974 2 жыл бұрын
why is person.parse have a red underline
C# Constructors Tutorial | Mosh
23:24
Programming with Mosh
Рет қаралды 241 М.
C# Tutorial For Beginners - Learn C# Basics in 1 Hour
1:10:32
Programming with Mosh
Рет қаралды 5 МЛН
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН
C# Events and Delegates Made Simple | Mosh
32:04
Programming with Mosh
Рет қаралды 955 М.
Every single feature of C# in 10 minutes
9:50
Train To Code
Рет қаралды 162 М.
8 Data Structures Every Programmer Should Know
17:09
ForrestKnight
Рет қаралды 225 М.
Classes & Objects | C# | Tutorial 25
13:25
Giraffe Academy
Рет қаралды 178 М.
Master C# Interfaces in 12 Minutes - Beginner Tutorial
11:37
tutorialsEU - C#
Рет қаралды 26 М.
how Google writes gorgeous C++
7:40
Low Level
Рет қаралды 979 М.
C# Generics Tutorial: Whats and Whys | Mosh
19:57
Programming with Mosh
Рет қаралды 263 М.
Functional Programming in 40 Minutes • Russ Olsen • GOTO 2018
41:35
GOTO Conferences
Рет қаралды 821 М.
Learn Any Programming Language In 3 Hours!
22:37
Code With Huw
Рет қаралды 619 М.
Brutally honest advice for new .NET Web Developers
7:19
Ed Andersen
Рет қаралды 292 М.
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН