Should I use reverse subscription to the interface?

If you have a common class with parameter overloads of different types, it seems generally accepted that you use the back-tick syntax in the file name:

MyType.cs MyType`1.cs MyType`2.cs 

Is it the same for the interface? For instance:

 IRepository.cs IRepository`2.cs 

If you have the appropriate type parameters:

 public interface IRepository { 

and

 public interface IRepository<T, in TId> { 
+4
source share
2 answers

File conventions are only personal / group preferences. You can do this if you decide so.

I personally put them in the same file. If I'm looking for an IRepository , I would suggest that all and all IRepository interfaces are similar, and they all represent a "repository", so I will just look for them in the same place. This avoids the need to determine which of the files are `2 , etc. To search. For me, "IRepository`5.cs" is not read and cannot be detected, which is why it finds everything in one file.

+13
source

Yes.
This convention applies to all types of types: ndash; classes, interfaces, and delegates.

+2
source

Source: https://habr.com/ru/post/1432524/


All Articles