Share via


CodeMemberMethod.TypeParameters Özellik

Tanım

Geçerli genel yöntem için tür parametrelerini alır.

public:
 property System::CodeDom::CodeTypeParameterCollection ^ TypeParameters { System::CodeDom::CodeTypeParameterCollection ^ get(); };
public System.CodeDom.CodeTypeParameterCollection TypeParameters { get; }
[System.Runtime.InteropServices.ComVisible(false)]
public System.CodeDom.CodeTypeParameterCollection TypeParameters { get; }
member this.TypeParameters : System.CodeDom.CodeTypeParameterCollection
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.TypeParameters : System.CodeDom.CodeTypeParameterCollection
Public ReadOnly Property TypeParameters As CodeTypeParameterCollection

Özellik Değeri

CodeTypeParameterCollection Genel yöntemin tür parametrelerini içeren bir.

Öznitelikler

Örnekler

Aşağıdaki kod örneği, öğesine iki tür parametre eklemek için özelliğinin CodeMemberMethodprintMethodkullanımını TypeParameters gösterir. Bu örnek, sınıfı için CodeTypeParameter sağlanan daha büyük bir örneğin parçasıdır.

// Declare a generic method.
CodeMemberMethod printMethod = new CodeMemberMethod();
CodeTypeParameter sType = new CodeTypeParameter("S");
sType.HasConstructorConstraint = true;
CodeTypeParameter tType = new CodeTypeParameter("T");
sType.HasConstructorConstraint = true;

printMethod.Name = "Print";
printMethod.TypeParameters.Add(sType);
printMethod.TypeParameters.Add(tType);
' Declare a generic method.
Dim printMethod As New CodeMemberMethod()
Dim sType As New CodeTypeParameter("S")
sType.HasConstructorConstraint = True
Dim tType As New CodeTypeParameter("T")
tType.HasConstructorConstraint = True

printMethod.Name = "Print"
printMethod.TypeParameters.Add(sType)
printMethod.TypeParameters.Add(tType)

Açıklamalar

Genel yöntem, tür parametreleri olarak bilinen bir veya daha fazla belirtilmemiş tür içerir. Tür parametresi adı, genel bildirimin gövdesindeki tür anlamına gelir.

Şunlara uygulanır

Ayrıca bkz.