Interfaces in C# - What they are, how to use them, and why they are so powerful.

Interfaces in C# - What they are, how to use them, and why they are so powerful.

IAmTimCorey

6 лет назад

441,930 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Gracian
Gracian - 14.09.2023 23:01

I have watched this last year. I'm watching right now. I understood your explanation last year, and now I know way more so it's a pleasure to watch it again because I see my progress. Thanks, man.

Ответить
Ioane Mamulashvili
Ioane Mamulashvili - 08.09.2023 13:23

Great job, you nailed it!

Ответить
Green Taco
Green Taco - 04.09.2023 22:06

Watched multiple tutorials to try and understand what the practical point of interfaces was and none of them really explain why they're so useful. All of them explained what they are and will say they're super useful, but they never really explained why I would actually need to use them. This tutorial explained the why perfectly and now I get it, they are very useful. Thank you.

Ответить
IShare4U
IShare4U - 30.07.2023 20:08

Thank you

Ответить
obi
obi - 19.07.2023 23:17

This is the clearest explanation of interface I have seen. Thank you

Ответить
Torrvic
Torrvic - 04.07.2023 22:48

You are truly a miracle for anybody learning CSharp Tim! I’ve learned so much stuff from your videos! I loved that you showed advanced technique when one interface can implement the other and then you can see methods and other stuff implemented in some concrete instance implementing one of this interfaces. Brilliant!
Thank you so much GREAT teacher! I hope that you are a very rich man because you truly deserve it!

Ответить
Rygar
Rygar - 21.06.2023 09:37

A lot of people will jump to inheriting from a base class rather than use an interface, the more you inherit, the harder the code gets to maintain as a general rule..

Ответить
Winters
Winters - 20.06.2023 04:28

Very nice explanation. Wouldn’t it be better to pass the customer inside the constructor of the IProductModel instead of through ShipItem and make ShipItem parameterless?

That way you are not forcing the CustomerModel class on everyone using IProductModels. What are you thoughts on that?

Ответить
Radostin Atanasov
Radostin Atanasov - 11.05.2023 13:44

Is this Polymorphism?

Ответить
Noemi L
Noemi L - 09.05.2023 11:58

Beautifully explained. Thank you !

Ответить
AsakuraAvan
AsakuraAvan - 15.04.2023 22:59

which implementation is used more often. Implementing an interface by another interface, or having a class implement multiple interfaces?

Ответить
Alejandro Sebastián Scotti
Alejandro Sebastián Scotti - 07.04.2023 16:42

Finally, I understand Interfaces ❤🎉🥲

Ответить
Mike Weber
Mike Weber - 27.03.2023 18:39

I know you mentioned not using a base class and inheritance, but to me (my limited knowledge), it seems that could still work in this scenario.

Ответить
İsim bulamadım o beni bulsun
İsim bulamadım o beni bulsun - 21.03.2023 21:09

Hi, I wanna point out that rather than understanding what the concept is, instead I spent more time on how your project works. Can't you create a console app and step by step add very simple implementations when you describe something.

Ответить
Shuvankar Bhowmick
Shuvankar Bhowmick - 21.03.2023 14:34

why doesn't the private set work tho?

Ответить
Mg Wai Yan Kyaw
Mg Wai Yan Kyaw - 17.03.2023 15:41

Thanks Sir!

Ответить
Anthony Russell
Anthony Russell - 24.02.2023 01:13

Thank you very much, lots of penny's dropped :)

Ответить
tanws8
tanws8 - 05.02.2023 06:26

could you do a video that shows the full coding differences when you use interface and without interface on a same program solution?

Ответить
AhmedHaider
AhmedHaider - 28.01.2023 15:37

Hello Tim,
In C#, How it comes the SqlConnection Class implements ICloneable interface, but the class does not provide a concrete implementation Or even declare the Clone() method of IColneable interface?
An explanation will be much appreciated
(Or at least provide me a link to a detailed answer, as this issue makes me frustrated about learning C#)

Ответить
JitteryJet
JitteryJet - 31.12.2022 00:33

Code-trolls on Programming forums do exist.

Ответить
Pako_Tube
Pako_Tube - 25.12.2022 14:33

Thank you Sir

Ответить
Willem vd K
Willem vd K - 09.12.2022 17:45

I love these video's Tim! I'm an experienced programmer with various different languages, C# was never one of them, but I'm trying to pick up C# to be able to help a colleague out. Most tutorials are way too basic and beginner-oriented. Your video's exactly hit the spot for me, teaching most of the real C# "gotcha's" instead of how logic operators and if-statements work.

Ответить
Cecil Champenois
Cecil Champenois - 09.12.2022 06:01

Thank, Tim. I was not aware that I could control the pixels level. Thank you. It's all very clear now.

Ответить
Cecil Champenois
Cecil Champenois - 09.12.2022 05:24

Video is not viewable or clear. Too bad, good explanations and knowledge, just cannot see the video.

Ответить
Elham Beydaghi
Elham Beydaghi - 07.12.2022 17:20

thanks! helped me alot

Ответить
Public Alias
Public Alias - 01.12.2022 08:02

I believe there is also now a default implementation possible? Correct me of I'm wrong.

Ответить
Rafael Rodrigues Silva
Rafael Rodrigues Silva - 28.11.2022 14:49

Thanks for everything

Ответить
Alessandro Guglielmina
Alessandro Guglielmina - 26.11.2022 14:51

Hi Tim, thank you for your very good tutorial! Just one question: why should i prefer a public setter over a constructor variable? Thanks!

Ответить
Saeid Ghasemi
Saeid Ghasemi - 15.11.2022 21:58

Thank you for this video. It is basic but with your explanation, It is very exciting and helpful.

Ответить
Hughes Mr
Hughes Mr - 11.11.2022 20:08

I am really pleased to be doing this course as it is the best However. I find programming is really confusing tough even though I have done the microsoft book 'c sharp in 24 hours, and half of caleb curry's c sharp course. The problem is similar to accounting, where I am the only one in the world who made a basic diagram of all the accounts. And in project management where I did similar. There are no physical representations of things. I don't understand if the productmodel is 1 product, a list of products. I don't get what get and set are and why they are everywhere.

Ответить
sze leong nicholas lui
sze leong nicholas lui - 05.11.2022 21:46

謝謝!

Ответить
Jake Zepeda
Jake Zepeda - 24.10.2022 16:34

Thanks for this. So many videos explain what an interface is and how to use it, but not what problems it solves over basic inheritance and why you would want to use it other than because someone told you to.
This was a great practical example :)

Ответить
BigWorldParty
BigWorldParty - 08.09.2022 20:47

Excellent tutorials. In depth so takes me some time reviewing, but covers the details. One thing, the issue was mentioned where an interface for example, may have only 3 properties, while the class implementing the interface may have 4 properties. And that 4th property, it cannot be access in the logic, because it's not part of the interface. It was mentioned in the tutorial there is way to access that 4th property, but then I didn't see later where that was explained. Unless ... the only way to access, is to do the "interface implementing an interface" approach? Anyway it seems like if a class has more properties than the interface it implements, the code will have problems accessing those extra class properties, without messing around with extra interfaces etc. I will have to watch the video again to see if I am understanding correctly.

Ответить
N trp
N trp - 08.09.2022 14:04

Your explaning approach is truly amazing. Thanks for your effort Tim.

Ответить
Exogen Design
Exogen Design - 07.09.2022 15:05

I finally understand this f*cking interface after tons of video, article then coming back at this with better knowledge of OOP. Basically if you want to do something with one pattern but with different values you used interface. You implement interface to modify something without destroying its initial structure. The beauty of it is you can add more methods, implementing it to a new class or to an existing class. I've watched this couple of days ago and I kinda didn't have the basic of c# and code directly so I relearn everything from classes/methods/constructors and this one. I have now fully grasp it power. This video just confirms my skeptical opinion if its true. Thank you Tim.

Ответить
stannis Barracuda
stannis Barracuda - 25.08.2022 22:54

best video i have ever seen on interfaces ever and i've been coding for 3 years

Ответить
Moha Sahal
Moha Sahal - 23.08.2022 19:55

are these videos some part of a course? because i would like to check it out.

Ответить
Eric Rosén
Eric Rosén - 22.08.2022 16:33

Great video! Thanks a lot for this!!

Ответить
Ajay Kumar K
Ajay Kumar K - 20.08.2022 11:26

Probably the best video on interfaces, I have seen on internet! Great job!!!

Ответить
Yazuki
Yazuki - 18.08.2022 05:15

What are lists for ?

Ответить
Jeanie Simmons
Jeanie Simmons - 17.08.2022 05:50

I'm sold. Subscribing now to your channel:)

Ответить
Greg Ohlsen
Greg Ohlsen - 12.08.2022 17:19

OMG Somebody that explains tech as well as Scott Allen (or better ;-))! Amazing!

Ответить
Gustavo Almeida
Gustavo Almeida - 11.08.2022 04:32

You save my life Tim, thank you very much. You are a true educator. I managed to understand everything and I'm not even an English speaker.

Ответить
Eric Wang
Eric Wang - 05.08.2022 16:32

I don't know man, to me the main difference between an abstract class and interface is that abstract class can have fields and default implementations using the virtual keyword on methods, what else is different? An interface is just an complete abstract class with properties and methods with empty bodies(or a contract like you've mentioned).

In the example you've provided, why can't you use an abstract class? You said what if you have a SerivceProductModel that doesn't have a ShipItem method, you really shouldn't inherit something that's not related to the base class, sure, but all your interfaces have this ShipItem method just with different implementations, can't you achieve the same result overriding the base abstract class in a subclass? It would be clearer if you have implemented this ServiceProductModel and use that with the interface instead to show us why an abstract class wouldn't work here. Great explanation btw, but i'm still baffled on when to use an abstract class and when to use an interface.

I've seen quotes like "Interfaces do not express something like "a Doberman is a type of dog and every dog can walk" but more like "this thing can walk"", so does it mean an interface is a generic abstract class about what it can do without caring about the type?

Ответить
朱亚君
朱亚君 - 04.08.2022 19:14

Nice Vedio, seem all for List😀

Ответить
toomanystraws
toomanystraws - 27.06.2022 18:33

Hey Tim, great video. FYI, the cert on the source code link expired and Chrome/Firefox are blocking access.

Ответить
Rosie Shiels
Rosie Shiels - 25.06.2022 12:09

Thanks so much for this video Tim. It has really helped me understand interfaces.

Ответить