2

Are C# extension methods considered as trait?

From what i read at wikipedia wikipedia a trait is a concept in OOP which represents a set of methods that can be used to extend the funcionality of a class. So the extension methods in C# do just that, don't they?

However in supported languages I cant see C# support which confuses me a lot. Do i understand the concept correctly?

  • https://stackoverflow.com/questions/10729230/how-would-you-implement-a-trait-design-pattern-in-c – Dmitry Bychenko May 29 '17 at 14:54
  • 2
    *"trait is a concept in OOP which represents a set of methods that can be used to extend the functionality of a class"* - that's the beginning, continue reading. The closest thing to trait in c# is `interface` as it seems, but they can't contain implementation, nor satisfy all traits of *trait*. – Sinatr May 29 '17 at 15:18

0 Answers0