Тёмный

C# Constructors Tutorial | Mosh 

Programming with Mosh
Подписаться 4 млн
Просмотров 232 тыс.
50% 1

Learn and understand constructors in C#
🔥Get the COMPLETE Course: bit.ly/2LhL39u
SUBSCRIBE FOR MORE VIDEOS!
/ @programmingwithmosh
STAY IN TOUCH
/ programmingwithmosh
/ moshhamedani

Опубликовано:

 

7 ноя 2017

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 158   
@drabantorgreyhound6613
@drabantorgreyhound6613 6 лет назад
Clear voice, clear audio quality, good display resolution and last but not least good content presented in a pedagogical way, thanks!
@pspicer777
@pspicer777 5 лет назад
Drabantor Greyhound Your comment is interesting as it is surprising how often these types of videos are unusable because they miss the mark on one of your criteria.
@dweebosupremo5904
@dweebosupremo5904 4 года назад
i actually feel that the voice is too bass-y and hard to understand.
@Rovsau
@Rovsau 3 года назад
This()
@ppogd9795
@ppogd9795 3 года назад
my mom asked on 13 o-clokc. what dosse ""pedagogical """""""" menanmean
@ppogd9795
@ppogd9795 3 года назад
ow i q on q q# me fulenrt s
@leuk2389
@leuk2389 5 лет назад
This was very smooth and easy to follow, thank you! For those not using ReSharper when making a new class do not add a namespace and if it has one remove it or your class will not work!
@The_DLK
@The_DLK 5 лет назад
Thank you mate , u made constructors sooo easy to understand and perfect please keep providing these videos ^_^
@tollinroth5939
@tollinroth5939 3 года назад
Thank you for your tutorials. They have been very helpful. If I may offer something in return, hold down "Ctrl + Shift + A". That is the keyboard shortcut for creating a "new something" for example the first item is often a new class. Just title it and hit enter. Saves time manually right clicking and searching. Thank you again for your help :)
@sunova_
@sunova_ 2 года назад
This was very helpful! Especially how you go thru the examples step by step. But furthermore, you provide best practice too. Superb!
@emanandchill
@emanandchill 6 лет назад
Thanks. Very good info. I had to find another c# tutorial for constructors and I found you. I learned a lot. Going to subscribe.
@preslavdelchev1203
@preslavdelchev1203 5 лет назад
That's what i call a great video. Excellent job! Simple and well explained, even a kid can understand it
@jjovanw
@jjovanw 6 лет назад
This is the best explanation of C# concepts I have ever seen. Keep up the good work!
@mylifeinvictus
@mylifeinvictus 6 лет назад
Dude, thanks so much for your tutorials! They are great!
@vomitjoe
@vomitjoe 6 лет назад
such a life saver. this tutorial explained it much better than my uni class!
@brunoh1673
@brunoh1673 5 лет назад
great tutorial ! Mosh you are a programming genius!
@johnconnor9787
@johnconnor9787 5 лет назад
Thank you. I did not know that when we create a constractor, the default one disappears and we need to declare parametrless constractor. You answered the question I had so many troubles with)) I wish I watched this earlier)) Thank you
@DarthJeremy364
@DarthJeremy364 5 лет назад
"you should code like a ninja"....yes yes this is exactly what i want
@rasheedram200
@rasheedram200 5 лет назад
Keep up the good work (Thank you very much for this great tutorial)
@nitro-ww6sk
@nitro-ww6sk 5 лет назад
High quality tutorials, worth your time!!!
@danieliglesias5805
@danieliglesias5805 4 года назад
Finally a really nice tutorial about constructors, thanks!
@babaktirgar
@babaktirgar 6 лет назад
Hi Mosh, Your Tutorials are incredibly Perfect! Thanks a lot. I really Suggest everyone to try them!!
@lukefox836
@lukefox836 5 лет назад
Thank you for the dark background.
@namronmanelok4119
@namronmanelok4119 2 года назад
This is really easy to follow and understand. Excellant!
@christofstanits
@christofstanits 6 лет назад
amazing tutorial! so very well explained!
@MohamedIbrahim-uk7mj
@MohamedIbrahim-uk7mj 6 лет назад
you are the best really
@ukaszk4410
@ukaszk4410 5 лет назад
I have a question. Why after you run it in 13:04 you get "press any key to continue"? For me the breakpoint makes it print only "1" and "John" is not displayed. I added Console.ReadLine() after and removed the breakpoint to get a similar effect, but I like your way much better. Please tell me how to get it this way. And anyway thanks a lot for this video!
@CrazyUnknownObject
@CrazyUnknownObject 10 месяцев назад
After watching the tutorial I understand the 'this' explanation within 10min. Awesome!
@erimun
@erimun 5 лет назад
I like your explanation.Thanks.
@fjeanjoseph
@fjeanjoseph 3 года назад
Awesome tutorial - Thank you so much!
@moldovandorin6187
@moldovandorin6187 4 года назад
mosh...you are a wonder of the universe
@dafiarecord72
@dafiarecord72 5 лет назад
Hey, thanks a lot, great videos in this channel, i subscribe, everything is clear. voice/presentation/Steps order, i learn more from u, thanks for all.
@miablazekovic1125
@miablazekovic1125 6 лет назад
Super awesome tutorial, thank you so much! :)
@jalalzoon4447
@jalalzoon4447 5 лет назад
yahh! it is.
@OriginalTubester
@OriginalTubester 6 лет назад
Great video, thank you
@dominiquedevries9972
@dominiquedevries9972 4 года назад
You are the best with Visual Studio!
@bahtiyorusmanov7211
@bahtiyorusmanov7211 4 года назад
Easy to understand explanation, thank you!
@zuque6199
@zuque6199 5 лет назад
Thank you so very much for the help!
@everythincomesaround
@everythincomesaround 3 года назад
Great video. I just did't get it with the list of objects. Do you always need to initialize these lists of objects in a constructor?
@dembasiby
@dembasiby 4 года назад
Thank you, Mosh!
@dave-th6yu
@dave-th6yu 4 года назад
You are amazing!!!!! Thank you Mosh!!!!!
@rtridico911
@rtridico911 11 дней назад
Great video! Thank you so much!
@mjollnirminchan7221
@mjollnirminchan7221 4 года назад
Thank you for your good work♪...all your videos are truly heplful...i wish you a good health♡
@DiscipleW
@DiscipleW 6 лет назад
Thank you Mosh!
@olekristianrannekleiv762
@olekristianrannekleiv762 Год назад
If you get an error when running the code, double check that you Console.WriteLine(costumer.ID) and not console.WriteLine(Costumer.ID) with a capital C. if you use capital C you try to output the class ID and not the object you created from the class.
@user-tr4og4pb3t
@user-tr4og4pb3t 3 года назад
YOU HELPED ME A LOT!!
@robertmarczak3991
@robertmarczak3991 4 года назад
Another Good one. Thanks Mosh.
@rawal16
@rawal16 6 лет назад
Great Mosh
@pritamd7k
@pritamd7k Год назад
Great , as usual Mosh! Looking for more videos on c# containing xUnit test case advance methods.
@MrBaiins
@MrBaiins 4 года назад
Good tutorial. Resharper is great but right clicking add class isn't a big deal, don't turn it into one. Most people here aren't professionals we are just here to learn. It's good to learn how to do things manually especially as newbies.
@owencoopersfx
@owencoopersfx 2 года назад
Excellent explanation. Thank you 🙏
@BijouBakson
@BijouBakson 2 года назад
You can tell it's a paid course. Very detailed and considerate. Thank you.
@tonismith1445
@tonismith1445 5 лет назад
So this is definitely more advanced topic than I am ready for. About half way through I'm literally just sitting there wondering what the heck he is even doing because I have no idea what constructors are and these other advanced topics. I'm going do some more reading and practicing and hopefully return to this topic later on when I know what a few of these things mean. However, that being said it's a good tutorial talking about Code Sharpner ect just not for beginners like myself at this time.
@srinivasaraoyp3640
@srinivasaraoyp3640 5 лет назад
Very interesting sir. Thank you..
@darkrist
@darkrist 4 года назад
:D i love the channel, I love the teaching methods!
@NestedMango
@NestedMango 5 лет назад
Great tuto..Sir...By using C# We can Make 2d and 3d game on Unity game engine. Unity is free.
@gregkoonce3059
@gregkoonce3059 6 лет назад
Code like a Ninja!
@Nick-wz6tz
@Nick-wz6tz 4 года назад
Thank you very much sir !
@anamnasirrollno0838
@anamnasirrollno0838 3 года назад
you are amazing!
@bongemhoangtu2468
@bongemhoangtu2468 6 лет назад
Hi can I ask something can you help me with the errors in visual studio with connect string : 'A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)' Thanks you
@poloska9471
@poloska9471 3 года назад
You probably know this by now, but for other people: Make sure that your IP address is whitelisted or the IP permissions constraint is disabled. Make sure that you spelled everything correctly and did not include the "..." in the server URL (include only: " some-server-name.database.windows.net "). Make sure that you specified the correct initial database name. Make sure that you provided all the minimum necessary parameters and the correct order when connecting via a connection string. Make sure that the database server and database are available for remote connections. Good luck!
@user-tx6yo7dj4g
@user-tx6yo7dj4g 9 месяцев назад
"Code like a Ninja"! This is the qoute that will form my career!
@Ali7Dali
@Ali7Dali 5 лет назад
Hi Mosh, thank you for the great video! I have a question: is it wrong to initialize variables or objects once you declare them instead of doing that in the constructor?? Thanks in advance!
@mortyjr2334
@mortyjr2334 5 лет назад
He uses a default constructor to initialize the List, this in itself is bad practice and should be done inline within the field itself, so the field should look like this: List orders = new List(); NOT: List orders;
@chrisalbers9184
@chrisalbers9184 4 года назад
Thank you!
@rahimeinollahi1
@rahimeinollahi1 6 лет назад
Thank you very nice.
@morty4815162342
@morty4815162342 3 года назад
very helpful, thanks
@XXIcenturyblood
@XXIcenturyblood 8 месяцев назад
0:06 - What is a constructor? 0:15 - Why need a constructor? 0:25 - Declare constructors 3:28 - Constructor overloading 4:49 - Demo
@mikeafter5
@mikeafter5 3 года назад
Thanks!
@user-tr4og4pb3t
@user-tr4og4pb3t 3 года назад
YOU ARE GREAT
@khazar5790
@khazar5790 6 лет назад
Great tutorial for constructors concept, thanks a lot! I just got a bit confused at the end when you describe about list of orders, it could be better to put an example there (rather than empty list maybe?).
@gowthammech1990
@gowthammech1990 4 года назад
agree
@olekristianrannekleiv762
@olekristianrannekleiv762 Год назад
the list is basicaly a box you can store things inside. "list" tells the program to make a box you can put things inside, "" describe what you are allowed to put inside this box. In this case only objects created by the class "orders" are allowed to be put inside this box. if he wrote list you could only put strings inside the box. It is abit confusing that he used a custom designed object as an example for what to put inside a list, i agree...
@amirprogramming6963
@amirprogramming6963 5 лет назад
thank you :) I suggest you if you could set some exercise , then we can practice it
@HeyMr.OO7
@HeyMr.OO7 11 месяцев назад
Best coding instructor
@sevensrikanth
@sevensrikanth 4 года назад
code like a ninja... well said...
@truetrueman680
@truetrueman680 4 года назад
What is the difference between constructors and classes? I'm a totally new when it comes to programming so sorry if I'm asking a dumb question
@hamedsaidalrawahi4082
@hamedsaidalrawahi4082 6 лет назад
thank you
@1986hr
@1986hr 5 лет назад
Ok this is useful.
@fahimehramezan3521
@fahimehramezan3521 29 дней назад
🥰🥰Thank you
@talk2s5061X
@talk2s5061X 2 года назад
code like a ninja I like this guy!!!
@sethell2
@sethell2 3 года назад
7:43 can someone explain to me the explicit way of writing var customer out? Thanks
@HaloWolf102
@HaloWolf102 3 года назад
What is the difference between var order = new Order() & customer.Orders = new List(); Also, I can't put var order = new Order() in the Customer() class. VS always tells me that I need another instance. So I always instance twice, instead of once.
@d-abdullah-b2191
@d-abdullah-b2191 4 года назад
When you creat the Customer object ,why did you put var instead of Customer?
@ivanfenis1221
@ivanfenis1221 5 лет назад
Hi Mosh. Thanks for explaining this topic well :). I just want to ask why "this." isn't needed for the "Orders" when you initialized it in the first Customer constructor? So "this.Orders = "
@thisisbob1001
@thisisbob1001 4 года назад
Maybe because it is in the default constructor you don't need thi? docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/instance-constructors
@nacramri6919
@nacramri6919 6 лет назад
perfect...
@omarelshayeb3492
@omarelshayeb3492 4 года назад
I laughed when you said you should code like a ninja :'D
@yoanngrudzien2588
@yoanngrudzien2588 4 года назад
I'm new at coding and wanna make sure I learn the correct conventions, I have a question : Shouldn't we be using camelCase for fields ? I learned that PascalCase was supposed to be used for properties. ex : public class Human { //camelCase for the field : public int age; //PascalCase for the property: public int Age { get {return age;} set { if (value < 0) { age = 0; } else { age = value; } } } } Thank you in advance to whoever answers me.
@aliciavegas5287
@aliciavegas5287 2 года назад
do you give private lessons ?
@johnconnor9787
@johnconnor9787 5 лет назад
Are your courses on udemy and codewithmosh com the same? If not then what is the difference between them Thank you
@thisisbob1001
@thisisbob1001 4 года назад
£50
@timeforrice
@timeforrice 2 года назад
Can you make a video like this for Interface?
@coronicrefugeestofffic6753
@coronicrefugeestofffic6753 Год назад
i was missing the static void string and was thinking it was cause i didnt have the handy dandy shrtcuts u got
@mrskujo4359
@mrskujo4359 5 лет назад
hey mosh when i create a new object order it shows error in my program
@thisisbob1001
@thisisbob1001 4 года назад
You made laugh 😀
@crabsynth3480
@crabsynth3480 5 лет назад
19:40 - Wow ... beauty ... that made me so happy :) ! : Ouch seconds later u made me realize that its actually ugly. How do you do that ? haha
@3rdtwirl494
@3rdtwirl494 Год назад
Hello. We would like to know more about building - well one day - forex trading bot . Where do we start
@bogdanmitroii6159
@bogdanmitroii6159 2 года назад
Why not.. In the Costumer Class, as a property.. you don't type this = public List Orders = new Lisy() ; And it will be always initialized without using a Constructor. Why not?
@annastaniszewska2172
@annastaniszewska2172 3 года назад
In all his videos about C#, Mosh is basically telling us "If you don't have Resharper, I'm sorry for you" and I'm actually very sorry for me cause of that :< I had it once, now I don't and it's such a loss...
@chelebarry
@chelebarry 6 лет назад
:'( I had problems understanding this topic hope I understand as I follow along...
@MessingWithCode
@MessingWithCode 2 года назад
HAHAAH yes sensei , yes hahahahahaahahah great video .
@amandabos6166
@amandabos6166 4 года назад
thank you Mosh, you taught me more in 23 min than my teacher at school in 4 hours :-)
@pragatirastogi5575
@pragatirastogi5575 4 года назад
Can constructor overriding happen
@princemalongo9303
@princemalongo9303 2 года назад
I have over understood. Everything here is clear.
@vaporalight3670
@vaporalight3670 6 лет назад
What happens if you remove "this" in this.Name?
@boblewis1287
@boblewis1287 2 года назад
To create an object of the class and initialize it
@simonmccorriston5347
@simonmccorriston5347 4 года назад
this is epic
@1spunch
@1spunch 5 лет назад
Clear voice. Talk only good way to do it, I think it will make more clear., not confused
@user-fo2cy4ee1u
@user-fo2cy4ee1u 6 лет назад
public List Orders { get ; private set;} Maybe good
@kunalsahadeva1940
@kunalsahadeva1940 5 лет назад
Can you please use white theme for visual studio
@VoidlingGeneral
@VoidlingGeneral 5 лет назад
NEVER dark mode is the future now!
@thisisbob1001
@thisisbob1001 4 года назад
@@VoidlingGeneral that's how it was back in the 80s!
@boblewis1287
@boblewis1287 2 года назад
Not to put an object in an early stage. It's to instantiate and initialize an object.
@tantinh4570
@tantinh4570 5 лет назад
As intructions "cw" but nothing happened ?
Далее
C# Object Initializers Tutorial
2:49
Просмотров 66 тыс.
C# Methods Tutorial | Mosh
24:29
Просмотров 113 тыс.
Наше обычное утро 💕
00:42
Просмотров 1,9 млн
C# Events and Delegates Made Simple | Mosh
32:04
Просмотров 937 тыс.
My 10 “Clean” Code Principles (Start These Now)
15:12
Learn to code with an unfair advantage.
15:05
Просмотров 171 тыс.
C# constructors 👷
5:44
Просмотров 76 тыс.
How to Learn to Code FAST (Do This or Keep Struggling)
11:00
C# Constructors - This is how to use them, and WHY
8:00
Object-oriented Programming in 7 minutes | Mosh
7:34
C# Lists 📃
6:46
Просмотров 99 тыс.
Constructors | C# | Tutorial 26
10:29
Просмотров 85 тыс.
Наше обычное утро 💕
00:42
Просмотров 1,9 млн