开发者

What does the tick mark `1 in the file name mean within the ASP.NET MVC source code?

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?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜