Port 型の 1 次元配列に、その配列内の指定した 0 から始まるインデックスを開始位置として PortCollection 全体をコピーします。
Public Sub CopyTo( _
ByVal array() As Port, _ ByVal index As Integer _)
[C#]
public void CopyTo(Port[] array,intindex);
[C++]
public: void CopyTo(Port* array[],intindex);
[JScript]
public function CopyTo(
array : Port[],index : int);
パラメータ
- array
コピー アクションのコピー先として使用する Port 型の配列。 - index
コピーされたコレクションの貼り付け開始位置を示す、0 から始まるインデックス番号。
使用例
myPortCollection = myService.Ports
' Create an array of Port objects.
Console.WriteLine(ControlChars.NewLine & "Port collection :")
Dim myPortArray(myService.Ports.Count) As Port
myPortCollection.CopyTo(myPortArray, 0)
Dim i1 As Integer
For i1 = 0 to myService.Ports.Count -1
Console.WriteLine("Port[" & i1.ToString + "] : " & _
myPortArray(i1).Name)
Next
[C#]
myPortCollection = myService.Ports;
// Create an array of Port objects.
Console.WriteLine("\nPort collection :");
Port[] myPortArray = new Port[myService.Ports.Count];
myPortCollection.CopyTo(myPortArray, 0);
for(int i1=0 ; i1 < myService.Ports.Count ; ++i1)
{
Console.WriteLine("Port[" + i1+ "] : " + myPortArray[i1].Name);
}
[C++]
myPortCollection = myService->Ports;
// Create an array of Port objects.
Console::WriteLine(S"\nPort collection :");
Port* myPortArray[] = new Port*[myService->Ports->Count];
myPortCollection->CopyTo(myPortArray, 0);
for(int i1=0 ; i1 < myService->Ports->Count ; ++i1)
{
Console::WriteLine(S"Port[{0}] : {1}", __box(i1), myPortArray[i1]->Name);
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
PortCollection クラス | PortCollection メンバ | System.Web.Services.Description 名前空間