我注意到了,也看到了必备 C# 3.0 https://rads.stackoverflow.com/amzn/click/com/0321533925书上,参数通常定义为T or TEntity
例如:
public class Stack<T>
{
}
or
public class EntityCollection<TEntity>
{
}
您如何决定使用哪个名称?
Thanks
我从以下位置获取了 .NET Framework 4.6 源代码http://referencesource.microsoft.com/dotnet46.zip http://referencesource.microsoft.com/dotnet46.zip。提取它并处理数据以从所有泛型类声明中提取泛型参数名称。
注意:我只从只有一个泛型参数的泛型类中提取了泛型参数名称。因此,这没有考虑具有多个泛型参数的泛型类。
grep -nohrP "class \w+<T\w*>" | sed -e 's/.*\<//' -e 's/>//' | sort | uniq -cd | sort -bgr
Result:
361 T
74 TChannel
51 TKey
33 TResult
30 TSource
28 T_Identifier
18 TElement
12 TEntity
11 TInputOutput
7 TItem
6 TLeftKey
6 TFilterData
5 T_Query
4 T_Tile
4 TInput
3 TValue
3 TRow
3 TOutput
3 TEventArgs
3 TDataReader
3 T1
2 TWrapper
2 TVertex
2 TValidationResult
2 TSyndicationItem
2 TSyndicationFeed
2 TServiceType
2 TServiceModelExtensionElement
2 TResultType
2 TMessage
2 TLocationValue
2 TInnerChannel
2 TextElementType
2 TException
2 TEnum
2 TDuplexChannel
2 TDelegate
2 TData
2 TContract
2 TConfigurationElement
2 TBinder
2 TAttribute
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)