This documentation is archived and is not being maintained.
OperationFaultCollection::CopyTo Method
Visual Studio 2010
Copies the entire OperationFaultCollection to a compatible one-dimensional array of type OperationFault, starting at the specified zero-based index of the target array.
Assembly: System.Web.Services (in System.Web.Services.dll)
Parameters
- array
- Type: array<System.Web.Services.Description::OperationFault>
An array of type OperationFault serving as the destination of the copy action.
- index
- Type: System::Int32
The zero-based index at which to start placing the copied collection.
PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; PortType^ myPortType = myPortTypeCollection[ 0 ]; OperationCollection^ myOperationCollection = myPortType->Operations; Operation^ myOperation = myOperationCollection[ 0 ]; OperationFaultCollection^ myOperationFaultCollection = myOperation->Faults; // Reverse the operation fault order. if ( myOperationFaultCollection->Count > 1 ) { OperationFault^ myOperationFault = myOperationFaultCollection[ 0 ]; array<OperationFault^>^myOperationFaultArray = gcnew array<OperationFault^>(myOperationFaultCollection->Count); // Copy the operation fault to a temporary array. myOperationFaultCollection->CopyTo( myOperationFaultArray, 0 ); // Remove all the operation faults from the collection. for ( int i = 0; i < myOperationFaultArray->Length; i++ ) myOperationFaultCollection->Remove( myOperationFaultArray[ i ] ); // Insert the operation faults in the reverse order. for ( int i = 0,j = (myOperationFaultArray->Length - 1); i < myOperationFaultArray->Length; i++,j-- ) myOperationFaultCollection->Insert( i, myOperationFaultArray[ j ] ); if ( myOperationFaultCollection->Contains( myOperationFault ) && (myOperationFaultCollection->IndexOf( myOperationFault ) == myOperationFaultCollection->Count - 1) ) Console::WriteLine( "Succeeded in reversing the operation faults." ); else Console::WriteLine( "Error while reversing the faults." ); }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: