views:

36

answers:

2

Looking in the ASP.NET MVC 2 source code there are several files in the System.Web.Mvc project that have an almost identically named file except for the `1 on the end of the file name.

For example, there is HtmlHelper.cs and HtmlHelper`1.cs. Another example is AjaxHelper.cs and AjaxHelper`1cs.

At first glance, the obvious answer is the `1 files contain the generic versions of their respective non-generic classes.

I'm wondering if there is something more to this naming convention though given that we have other files like ReaderWriterCache`2.cs which contains the ReaderWriterCache file that doesn't inherit from any type of non-generic base class.

Does anyone have a better idea on what the naming convention is used to denote?

+4  A: 

The number at the end indicates the number of generic type parameters. So, ReaderWriterCacherequires'2 requires 2 type parameters, TKey and TValue. HtmlHelper'1 only requires 1.

Mark Brackett
A: 

Not sure if this is even relevant, but here's some code snippets from a project:

List<UserAction> myUserActionList;    
DataGridTableStyle ts = new DataGridTableStyle();
ts.MappingName = "List`1"; //ts.MappingName = myUserActionList.GetType().Name;

The last line contains a comment which could have replaced that line with no difference in behaviour.

Abhijeet Kashnia