Encapsulation in c# | Practical OOPs with c#

  Рет қаралды 11,047

Ravindra Devrani

Ravindra Devrani

Күн бұрын

Пікірлер: 20
@kirank-y4u
@kirank-y4u Жыл бұрын
Excellent, I have been learning c# from last 6 months, this video made many things clear to me.
@ravindradevrani
@ravindradevrani Жыл бұрын
Glad to hear✌️
@kumarabhishekranjan4694
@kumarabhishekranjan4694 Ай бұрын
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.
@chimezieokafor-muo4356
@chimezieokafor-muo4356 10 ай бұрын
this is the best explanation I have seen
@otetumooluwaseun3948
@otetumooluwaseun3948 11 ай бұрын
Thanks for the explanation. This is like a 3 in 1 combo
@zargamali8531
@zargamali8531 8 ай бұрын
thank you so much. you explained it very well.
@trapmixer6349
@trapmixer6349 10 ай бұрын
nice video, easy to understand
@ravindradevrani
@ravindradevrani 8 ай бұрын
Glad to hear that!
@qadeerulla
@qadeerulla Жыл бұрын
Excellent videos
@nouchance
@nouchance 2 жыл бұрын
Thank you Ravindra!
@ravindradevrani
@ravindradevrani 2 жыл бұрын
My pleasure
@connorwalding-c6m
@connorwalding-c6m 5 ай бұрын
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!
@ravindradevrani
@ravindradevrani 5 ай бұрын
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-c6m
@connorwalding-c6m 5 ай бұрын
@@ravindradevrani Thanks Ravi, appreciate the clarification! Keepup the great content
@AmitYadav-vp6ff
@AmitYadav-vp6ff 2 жыл бұрын
Excellent
@ravindradevrani
@ravindradevrani 2 жыл бұрын
Thank you! Cheers!
@raveendharmasiri
@raveendharmasiri 9 ай бұрын
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.
@ravindradevrani
@ravindradevrani 9 ай бұрын
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.
@nirjhor8395
@nirjhor8395 2 жыл бұрын
need full series of OOps
@ravindradevrani
@ravindradevrani 2 жыл бұрын
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
ENCAPSULATION IN C# ( URDU / HINDI )
36:38
Learning Never Ends
Рет қаралды 82 М.
How to have fun with a child 🤣 Food wrap frame! #shorts
0:21
BadaBOOM!
Рет қаралды 17 МЛН
«Жат бауыр» телехикаясы І 26-бөлім
52:18
Qazaqstan TV / Қазақстан Ұлттық Арнасы
Рет қаралды 434 М.
Debugging C# Code in Visual Studio | Mosh
31:42
Programming with Mosh
Рет қаралды 390 М.
What is gRPC, How to use gRPC and implement gRPC services in .NET9
25:20
C# polymorphism 🎭
5:11
Bro Code
Рет қаралды 90 М.
Fundamental Concepts of Object Oriented Programming
9:16
Computer Science Lessons
Рет қаралды 974 М.
Abstraction with c# | Practical OOPs with c#
3:29
Ravindra Devrani
Рет қаралды 401
Getters & Setters | C# | Tutorial 28
12:09
Giraffe Academy
Рет қаралды 196 М.
SOLID Principles in c#
14:28
Ravindra Devrani
Рет қаралды 346
Inheritance vs Interfaces in C#: Object Oriented Programming
49:41
IAmTimCorey
Рет қаралды 104 М.
Every single feature of C# in 10 minutes
9:50
Train To Code
Рет қаралды 163 М.
How to have fun with a child 🤣 Food wrap frame! #shorts
0:21
BadaBOOM!
Рет қаралды 17 МЛН