私は気づいたし、必須 C# 3.0本書では、パラメータは通常次のように定義されていますTまたはTエンティティ
例えば:
public class Stack<T>
{
}
または
public class EntityCollection<TEntity>
{
}
どの名前を使用するかをどのように決めますか?
ありがとう
ベストアンサー1
.NET Framework 4.6のソースコードを以下から取得しました。http://referencesource.microsoft.com/dotnet46.zipそれを抽出し、データを処理して、すべてのジェネリック クラス宣言からジェネリック パラメーター名を抽出しました。
注: ジェネリック パラメータが 1 つだけのジェネリック クラスからジェネリック パラメータ名のみを抽出しました。したがって、複数のジェネリック パラメータを持つジェネリック クラスは考慮されません。
grep -nohrP "class \w+<T\w*>" | sed -e 's/.*\<//' -e 's/>//' | sort | uniq -cd | sort -bgr
結果:
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