BP4: Explicit implementation of multiple interfaces

When your class implements multiple interfaces with a lot of methods it's best to explicitly implement them. This way it's immediately visible which method corresponds to which interface.

Comments

Anonymous
Oh, I can't say how much I hate the partial keyword. People are tempted to abuse it. By splitting the large class to smaller files using partial keyword, they start to think that things are clean where actually they are often not. Too long class usually means it's doing to many things. The Single Responsibility Principle is there for a reason. Organizing the large class with multiple responsibilities to multiple smaller files won't make the class cleaner.
Anonymous
What I always like to do is make the class partial then make a partial per interface: public partial class MyObject {} public partial class MyObject : IDisposable {} public partial class MyObject : IStream {} Then put them in files like MyObject.Disposable.cs, MyObject.Stream.cs and make then DependUpon in the project file.

Download Better Coder application to your phone and get unlimited access to the collection of enterprise best practices.

Get it on Google Play