Composite Design Pattern (C#)
Вставка
- Опубліковано 1 чер 2024
- The composite design pattern explained with examples in code.
Patreon 🤝 / raw_coding
Courses 📚 learning.raw-coding.dev
Shop 🛒 shop.raw-coding.dev
Discord 💬 / discord
Twitter 📣 / anton_t0shik
Twitch 🎥 / raw_coding
Playlist: • c# design patterns
Source: github.com/raw-coding-youtube...
#csharp #composite #designpatterns
Channels like these is why I pay my broadband bills❤️.
Thanks brother.
Got what I was looking for.
Glad you like it
Thank you for all of the design pattern videos, it's been very helpful for studying for my test :))
Glad you enjoyed them
Thanks for the video!
Thank you for watching
Great video, as always 👍
Cheers )
Your channel is a gem! Which book have you read about design patterns?
i'm learning a ton from you.
Glad to hear
Very nice explain . but some what i feel lost in the example and missed the actual usage and applicability of the pattern.
may be you can explain by taking example of sending mails as we can send mail to single user and group of users which having same functionality i.e send
and group can contains nested group and members .
Eya, sorry the example didn’t help. Maybe one of these: Product Trees (table has legs, bolts etc...), Element Trees (html, xml elements contain other elements) permissions (build up bigger permissions out of smaller ones and re use bigger ones to build up even bigger permissions)
Матрёшка pattern! Hope you got Babushka pattern too
haha no babushka pattern sorry :P
when i create the composite class that returns a list of itself without interface it gives StackOverflow exception and i understand it's normal,, however, when the class implements interface like your example it doesn't throw the exception why??
i noticed that when using interface the list children would be created when they are called like lazy loading! so I think this is the reason,, but again why it's lazy loading when using interface ??
You'll need to show code example of what you are doing, an object referencing another object of same type shouldn't be a problem. Perhaps you are using static fields?
@@RawCoding literally like what you did in your linqpad, the result windwo has list representation and when you expand the child it has another list over and over.. this is the behavior I ask about why it doesn't give exceptions? try to remove the interface next to class name then the exception occurs
Make sure you are passing a new instance and now the same instance so you’ll have a circular reference
👍🏽
)
U are a masochist 😁
Everyone is a bit