ServiceCollection.CopyTo メソッド
ServiceCollection 全体を Service 型の 1 次元配列にコピーします。コピーは、コピー先の配列の指定した 0 から始まるインデックス番号から開始します。
Public Sub CopyTo( _
ByVal array() As Service, _ ByVal index As Integer _)
[C#]
public void CopyTo(Service[] array,intindex);
[C++]
public: void CopyTo(Service* array[],intindex);
[JScript]
public function CopyTo(
array : Service[],index : int);
パラメータ
- array
コピー アクションのコピー先として使用する Service 型の配列。 - index
コピーされたコレクションの貼り付け開始位置を示す、0 から始まるインデックス番号。
使用例
Dim myServiceArray(myServiceDescription.Services.Count - 1) _
As Service
' Copy the services into an array.
myServiceDescription.Services.CopyTo(myServiceArray, 0)
Dim myEnumerator As IEnumerator = myServiceArray.GetEnumerator()
Console.WriteLine("The names of services in the array are")
While myEnumerator.MoveNext()
Dim myService1 As Service = CType(myEnumerator.Current, Service)
Console.WriteLine(myService1.Name)
End While
[C#]
Service[] myServiceArray =
new Service[myServiceDescription.Services.Count];
// Copy the services into an array.
myServiceDescription.Services.CopyTo(myServiceArray,0);
IEnumerator myEnumerator = myServiceArray.GetEnumerator();
Console.WriteLine("The names of services in the array are");
while(myEnumerator.MoveNext())
{
Service myService1 = (Service)myEnumerator.Current;
Console.WriteLine(myService1.Name);
}
[C++]
Service* myServiceArray[] =
new Service*[myServiceDescription->Services->Count];
// Copy the services into an array.
myServiceDescription->Services->CopyTo(myServiceArray,0);
IEnumerator* myEnumerator = myServiceArray->GetEnumerator();
Console::WriteLine(S"The names of services in the array are");
while(myEnumerator->MoveNext())
{
Service* myService1 = dynamic_cast<Service*>(myEnumerator->Current);
Console::WriteLine(myService1->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 ファミリ
参照
ServiceCollection クラス | ServiceCollection メンバ | System.Web.Services.Description 名前空間