Nice explanation, easy to understand. This is like buy 1 and get 3. This video helped me in polishing my c# skills. Keep the great work on.
@kirank-y4u Жыл бұрын
Excellent, I have been learning c# from last 6 months, this video made many things clear to me.
@ravindradevrani Жыл бұрын
Glad to hear✌️
@otetumooluwaseun39489 ай бұрын
Thanks for the explanation. This is like a 3 in 1 combo
@chimezieokafor-muo43568 ай бұрын
this is the best explanation I have seen
@zargamali85316 ай бұрын
thank you so much. you explained it very well.
@trapmixer63498 ай бұрын
nice video, easy to understand
@ravindradevrani7 ай бұрын
Glad to hear that!
@raveendharmasiri7 ай бұрын
everything is good except I wished that you would expalin the concept behind auto implemented properties. So as far I understand. in this case in the backgrond the compiler creates a private field for this property "name" to contain its values and then creates the getter and setter methods for this property. All this happens in the background and you will not be able to see that in the code. That is why we use the -> public String name { get; set; }. Only if you run into the need of writing your own implementation for the setter or getter method, you have to go with the second approach as shown in the video.
@ravindradevrani7 ай бұрын
Yes everything you have said is absolutely right. C# compiler takes care of implementing private field. User need to focus on auto implemented property only. And it is the default approach of using it these days.
@connorwalding-c6m3 ай бұрын
Hi Ravi, thanks for you video. I am just starting in uni so wanted to know the first file (encapsulation.cs) and the second (encapsulationproperties.cs) are they just two different examples of the same project done in different ways. Really helpful thankyou!
@ravindradevrani3 ай бұрын
These are the different implementation of same example. Public class Person{ private int age public int GetAge() { return age; } public void SetAge (int age) { if(age>0){ this.age=age; } } public void Display() { /// logic } } It is how encapsulation actually works. That is shown by java. Everything is clear here. We don't want to give direct access of age field to the client. If you don't then any one can enter the negative number there. Instead we give user the getter() and setter() methods to manipulate the age field. This example is enough for explaining encapsulation. If we are using java. But c# have multiple ways to do it. These are the different implementation of same example. Public class Person{ public int Age { get; set { if(value>0) { Age=value; } } public void Display() { /// logic } } Now user can access the Age but can not negative numbers to the age. It is the same thing but with different mechanism. First example is more straightforward. Second example does some magical things. Both are same. Both are protecting your data. But second example is more C#-ish. I hope you understood it. If you are following this OOP series. Then I would recommend you learn polymorphism from this article. It covers more depth. ravindradevrani.medium.com/polymorphism-in-c-ea312521d050
@connorwalding-c6m3 ай бұрын
@@ravindradevrani Thanks Ravi, appreciate the clarification! Keepup the great content
@nouchance2 жыл бұрын
Thank you Ravindra!
@ravindradevrani2 жыл бұрын
My pleasure
@qadeerulla Жыл бұрын
Excellent videos
@nirjhor8395 Жыл бұрын
need full series of OOps
@ravindradevrani Жыл бұрын
What comes in full series? Check out this c# playlist,may be you will find what you are asking C# complete course: kzbin.info/aero/PLP8UhDwXI7f_1lze_yKyG-51rS9WNAgMG