4 ms·
How should one call or use it? Any example or a link?
by chown 15y ago
How should one call or use it? Any example or a link?
- jb55 15y agohttps://gist.github.com/1313735 https://gist.github.com/1313735 Here's a full example in some production code. I ended up doing it this way to simplify some crazy legacy code. There were a bunch of different classes that provide order items and extended prices in different ways. With this setup as long as those types implement the necessary interfaces, they get those extension methods for free.
- mattmanser 15y agoSimply: orderItems.CalculateTaxes(); If orderItems implements IOrderItems. Just have to include a using statement for the namespace it's in, it's an extension method. Look them up if you're unsure. I didn't know you could do that with them, it's pretty cool. Although it's kinda what abstract classes and inheritance is for, but you can only inherit from one in C#.