C# Tutorial 5 Classes & OOP

Get the Code Here : https://goo.gl/p6mDqi
Best C# Book : http://amzn.to/2iMArkU
Support me on Patreon : https://www.patreon.com/derekbanas

We start learning about object oriented programming in this part of my C# tutorial. We’ll cover Classes, Methods, Fields, Constructors, Static Classes, Methods and Fields, Structs and Nullable Types. I’m going to cover OOP over a few videos to make sure everyone completely understands everything.

For best results take notes on the cheat sheet provided above as you watch and leave any questions you have.

Thank you to Patreon supporters like the following for helping me make this video

jaryd remillard : instagram: @distant_admiration
jaryd remillard : https://github.com/YearOfProgramming/2017Challenges


John Agapi says:

How you could spend hours of time explaining, recording, organizing code, maintaining it on your Website and do all of it with such seemingly “flow” is for me one of the biggest confirmation of selflessness Derek. Couldn’t Thank you enough. Thanks are useless. On Patreon soon.

Ben says:

Will you be doing Java tutorials?

Enkii Muto says:

I’m still confused of when exactly write.line is executed for it to take the change of value it was set after it is called.

Can anybody explain this to me?

Jahangir Mammadov says:


Kaya says:

Why would you use method Area instead of property Area, I think we don’t need method here cuz our object knows it’s properties(area is property).If we had to move object in that case the method is the right way of doing it, but now I think it is a mistake

Vlad Nedelescu says:

Big up Derek! Is web dev also in your schedule?

Nath uneke says:

I enjoy your video because you are very articulate. Please, can you do a tutorial that teach and exlpain each code, telling what it does, step by step? Using C# and windows form or wpf. My very important topics include, datasource, databinding, fields and properties.

H1P9Y says:


Viviana V says:

this is great!!

eduardo blanco says:

Thank you soooo much for this.series of tutorials Derek Bananas, they are great !!!! Is so hard to find a good tutorial about this.topic in youtube. Congratulations!!!!!

Amin Nausin says:

I watched your 2015 version Of this tutorial. Found it very insightful. Then I saw this and got excited since it covers so much more. Thanks! Gold.

Kohbra says:


Learn Code says:


Swati Goswami says:

your programming tutorials are helping me a lot

mau lopez says:

I like the sound of the fox, never had heard a fox before ! : ) . No, seriously, thanks for this course Derek, it’s great, a little bit lightning fast, but so far, so good !

Almarghulani says:

Hello! really appreciate your videos. Can you make a video on bitmap manipulation via (Bitlocks)? Things like crop, quadrilateral transform, filters, etc…

sean893 says:


And learning the Animal and ShapeMath class!

Yuriy Paslavsky says:

11:50 best moment

Kristian Dimitrov says:

Rawwww 😀 Nice fox sound buddy:D Great job with your tutorials anyway!

fera fera says:

thank you very much keep on!
so as I understand from the video that structure and class are the same but the difference between them that class unlike structure may inherit from it !
or there are other differences ? what are they?

Disciplined Coding says:

Is it true that the reason developers wear glasses is because they can’t C#??

Matthew Bishop says:

What does the fox say? Finally we know the answer to this age old question. The fox says “Raaww”.

forouhar mohammadpanah says:

thank you 4 making these tutorial, love U

Kerreber says:

gold. and thanks a lot for these tutorials!

Kevin Merenger says:

Do you believe that C# is a good language to choose and start programming today in 2017 with the mobile revolution ? I know there is xamarin and all but it cost money and you can have Javascript everywhere now with phonegap and the open source community in Javascript seem very big and on the edge compared to MS Asp.net…. What you think about all this ?

Sa Alam says:


M M21 says:

First of all before I watch your video! Thank you for how awesome you are. You have amazing teaching skills, best teacher out there for sure! You are my (internet) teacher and you don’t know how much I appreciate your work! Thank you! <3

Mak Junior says:

The biggest challenge I found in this video is at 3:45. You said that when you assign rect2 = rect1 , they are not referencing the same object. But how? In oop we know unlike variable, when we assign an object to a variable, the variable points to that object. So, when we did rect2 = rect2 ; they both should point to the same rectangle object , thus if I change the length of rect1 , then rect2.length will automatically get changed since they are pointing the save object after all. What am I missing here ?

NickBossBG says:

You made these series for completely beginners or for people who has knowledge from other languages ?

Disciplined Coding says:

Hello Derek, thanks for this tutorial, could you touch on “garbage collectors”? Love your channel esp on OOP. “Gold please”!!! 😉

smaster7772 says:

by this video I really got lost with some Of the different terminology like object, struct, constructer is there any way you could explain these in a simpler way?

Richard Bromilow says:

you are a Tech-Rockstar Derek, thank you for all your effort putting these together

Madolite says:

I didn’t quite get that. What does the Fox say?!! Wa-pa-pa-pa-pa-pa-pow!

Daniel Bray says:

How do we add a class using Xamarin? I’ve found that typing the code at the bottom outside of ‘main’ works, but is there a better way?

Angelina Jolie says:

Hi Derek ! Could you please do P.D.O in one video?
Thanks in Advance !

ShrineFox says:

Thanks so much for making these videos, this helped me understand how to use classes a little better. That’s pretty much all I needed but I learned some cool things in the previous videos too that I never would have thought of. Can’t wait for more!

Unknown Account says:

Shoudent we be using the Setter Getter method like in C++?

element74 says:

Are there any differences between creating a class in a separate .cs file vs creating the class inside the namespace of your Program.cs file?

Paul Sihasutthi says:

No it’s ding ding and wa pa pa pow

Yossef Gamal says:

hey Derek I suggest that you provide the time of everysingle thing you explain like if you are explaining strings you would provide the time like that string 00:00 and people get to read the cheat sheet then if they didn’t understand a specific thing they would go the video and understand it so you can make it faster for them to learn I hope that helps and keep up the great content

Ryan says:

Dam, I just realized that these are current and no video #6 exist yet. They’re so easy to watch that when they’re over, you’re like, wow that went fast. If college was only this easy. I’ve found them to be very good for covering basic concept and just getting a general feel for the language and syntax. Guess I’ll use the time to continue with your Java content. Cheers

Mahdi Heydari says:

Hello dear Derek and thanks for your tutorial.
there are two questions about these tutorial. I’m using visual c# 2008, and I see two errors even when I copy exactly the coses you’ve written,
1. when I type code ” public Animal(string name = “No Name”) “, then it shows the error : “default parametere specifies are not permitted”, so i have to specify amounts in another command. so why there is these differences ?
2. when I use the code ” name = “Red”; ” there is also the error : ” the name ‘name ‘ does not exist in the current context. What should I do to fix this problem?
Thank you for your answers.

 Write a comment


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!