OperationFaultCollection.Item Property (Int32)
.NET Framework 3.0
Gets or sets the value of an OperationFault at the specified zero-based index.
Namespace: System.Web.Services.Description
Assembly: System.Web.Services (in system.web.services.dll)
Assembly: System.Web.Services (in system.web.services.dll)
public: property OperationFault^ default [int] { OperationFault^ get (int index); void set (int index, OperationFault^ value); }
/** @property */ public OperationFault get_Item (int index) /** @property */ public void set_Item (int index, OperationFault value)
Not applicable.
Parameters
- index
The zero-based index of the OperationFault whose value is modified or returned.
Property Value
An OperationFault.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." ); }
PortTypeCollection myPortTypeCollection = myServiceDescription.
get_PortTypes();
PortType myPortType = myPortTypeCollection.get_Item(0);
OperationCollection myOperationCollection = myPortType.
get_Operations();
Operation myOperation = myOperationCollection.get_Item(0);
OperationFaultCollection myOperationFaultCollection = myOperation.
get_Faults();
// Reverse the operation fault order.
if (myOperationFaultCollection.get_Count() > 1) {
OperationFault myOperationFault = myOperationFaultCollection.
get_Item(0);
OperationFault myOperationFaultArray[] = new OperationFault[
myOperationFaultCollection.get_Count()];
// Copy the operation faults to a temporary array.
myOperationFaultCollection.CopyTo(myOperationFaultArray, 0);
// Remove all the operation faults from the collection.
for (int i = 0; i < myOperationFaultArray.get_Length(); i++) {
myOperationFaultCollection.Remove(myOperationFaultArray.
get_Item(i));
}
// Insert the operation faults in the reverse order.
for (int i = 0, j = myOperationFaultArray.get_Length() - 1;
i < myOperationFaultArray.get_Length(); i++, j--) {
myOperationFaultCollection.Insert(i, myOperationFaultArray.
get_Item(j));
}
if (myOperationFaultCollection.Contains(myOperationFault)
&& myOperationFaultCollection.IndexOf(myOperationFault)
== myOperationFaultCollection.get_Count() - 1) {
Console.WriteLine("Succeeded in reversing the operation "
+ "faults.");
}
else {
Console.WriteLine("Error while reversing the faults.");
}
}
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.Community Additions
ADD
Show: