OperationFaultCollection.Item[] Свойство
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Получает или задает объект OperationFault, определенный переданным параметром.
Перегрузки
Item[Int32] |
Получает или задает значение объекта OperationFault по указанному индексу (отсчитываемому с нуля). |
Item[String] |
Возвращает объект OperationFault по его имени. |
Item[Int32]
Получает или задает значение объекта OperationFault по указанному индексу (отсчитываемому с нуля).
public:
property System::Web::Services::Description::OperationFault ^ default[int] { System::Web::Services::Description::OperationFault ^ get(int index); void set(int index, System::Web::Services::Description::OperationFault ^ value); };
public System.Web.Services.Description.OperationFault this[int index] { get; set; }
member this.Item(int) : System.Web.Services.Description.OperationFault with get, set
Default Public Property Item(index As Integer) As OperationFault
Параметры
- index
- Int32
Индекс (с нуля) объекта OperationFault, значение которого изменяется или возвращается.
Значение свойства
Объект 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.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];
OperationFault[] myOperationFaultArray =
new OperationFault[myOperationFaultCollection.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.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.");
}
}
Dim myPortTypeCollection As PortTypeCollection = _
myServiceDescription.PortTypes
Dim myPortType As PortType = myPortTypeCollection(0)
Dim myOperationCollection As OperationCollection = _
myPortType.Operations
Dim myOperation As Operation = myOperationCollection(0)
Dim myOperationFaultCollection As OperationFaultCollection = _
myOperation.Faults
' Reverse the operation fault order.
If myOperationFaultCollection.Count > 1 Then
Dim myOperationFault As OperationFault = _
myOperationFaultCollection(0)
Dim myOperationFaultArray(myOperationFaultCollection.Count -1 ) _
As OperationFault
' Copy the operation faults to a temporary array.
myOperationFaultCollection.CopyTo(myOperationFaultArray, 0)
' Remove all the operation faults from the collection.
Dim i As Integer
For i = 0 To myOperationFaultArray.Length - 1
myOperationFaultCollection.Remove(myOperationFaultArray(i))
Next i
' Insert the operation faults in the reverse order.
Dim j As Integer = myOperationFaultArray.Length - 1
i = 0
While i < myOperationFaultArray.Length
myOperationFaultCollection.Insert(i, myOperationFaultArray(j))
i += 1
j -= 1
End While
If myOperationFaultCollection.Contains(myOperationFault) And _
myOperationFaultCollection.IndexOf(myOperationFault) = _
myOperationFaultCollection.Count - 1 Then
Console.WriteLine("Succeeded in reversing the operation faults.")
Else
Console.WriteLine("Error while reversing the faults.")
End If
End If
Применяется к
Item[String]
Возвращает объект OperationFault по его имени.
public:
property System::Web::Services::Description::OperationFault ^ default[System::String ^] { System::Web::Services::Description::OperationFault ^ get(System::String ^ name); };
public System.Web.Services.Description.OperationFault this[string name] { get; }
member this.Item(string) : System.Web.Services.Description.OperationFault
Default Public ReadOnly Property Item(name As String) As OperationFault
Параметры
- name
- String
Имя возвращенного объекта OperationFault.
Значение свойства
Объект OperationFault
.
Примеры
OperationFaultCollection^ myOperationFaultCollection = myOperation->Faults;
OperationFault^ myOperationFault = myOperationFaultCollection[ "ErrorString" ];
if ( myOperationFault != nullptr )
myOperationFaultCollection->Remove( myOperationFault );
OperationFaultCollection myOperationFaultCollection =
myOperation.Faults;
OperationFault myOperationFault =
myOperationFaultCollection["ErrorString"];
if( myOperationFault != null )
{
myOperationFaultCollection.Remove(myOperationFault);
}
Dim myOperationFaultCollection As OperationFaultCollection = _
myOperation.Faults
Dim myOperationFault As OperationFault = _
myOperationFaultCollection("ErrorString")
If Not (myOperationFault Is Nothing) Then
myOperationFaultCollection.Remove(myOperationFault)
End If