Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Of T or Of TEntity?

Tags:

.net

vb.net

I know this is a stupid question maybe, but what is the naming standard for generics?

Of t or Of TEntity or Of... it doesn't really matter?

I see IQueryable(Of T) but then DBSet(Of TEntity).

like image 806
Sam Avatar asked Mar 16 '11 05:03

Sam


1 Answers

Microsoft makes the following recommendations in Generics FAQ: Best Practices:

Name generic type parameters with descriptive names, unless a single letter name is completely self explanatory and a descriptive name would not add value. [...] If you have no additional contextual information about the type parameter, you should use the letter T.

Public Class SomeClass(Of T)

Public Interface ISessionChannel(Of TSession)

I generally follow Microsoft's naming conventions unless I have a really good reason not to, if only because so many other devs do as well, and it's easy to move around different codebases.

like image 185
Michael Petrotta Avatar answered Nov 24 '22 13:11

Michael Petrotta