Поделиться через


FaultBindingCollection.Item[] Свойство

Определение

Возвращает или задает экземпляр FaultBinding, заданный передаваемым параметром.

Перегрузки

Item[Int32]

Возвращает или задает значение FaultBinding по указанному индексу (с нуля).

Item[String]

Получает объект FaultBinding, заданный его именем.

Item[Int32]

Исходный код:
ServiceDescription.cs
Исходный код:
ServiceDescription.cs
Исходный код:
ServiceDescription.cs

Возвращает или задает значение FaultBinding по указанному индексу (с нуля).

public:
 property System::Web::Services::Description::FaultBinding ^ default[int] { System::Web::Services::Description::FaultBinding ^ get(int index); void set(int index, System::Web::Services::Description::FaultBinding ^ value); };
public System.Web.Services.Description.FaultBinding this[int index] { get; set; }
member this.Item(int) : System.Web.Services.Description.FaultBinding with get, set
Default Public Property Item(index As Integer) As FaultBinding

Параметры

index
Int32

Индекс (с нуля) объекта FaultBinding, значение которого изменяется или возвращается.

Значение свойства

FaultBinding.

Исключения

Значение параметра index меньше нуля.

-или-

Значение параметра index больше значения Count.

Примеры

В следующем примере показано типичное FaultBinding использование класса .

FaultBindingCollection^ myFaultBindingCollection = myOperationBinding->Faults;
FaultBinding^ myFaultBinding = gcnew FaultBinding;
myFaultBinding->Name = "ErrorString";
// Associate SOAP fault binding to the fault binding of the operation.
myExtensions = myFaultBinding->Extensions;
SoapFaultBinding^ mySoapFaultBinding = gcnew SoapFaultBinding;
mySoapFaultBinding->Use = SoapBindingUse::Literal;
mySoapFaultBinding->Namespace = "http://www.contoso.com/stockquote";
myExtensions->Add( mySoapFaultBinding );
myFaultBindingCollection->Add( myFaultBinding );
FaultBindingCollection myFaultBindingCollection = myOperationBinding.Faults;
FaultBinding myFaultBinding = new FaultBinding();
myFaultBinding.Name = "ErrorString";
// Associate SOAP fault binding to the fault binding of the operation.
myExtensions = myFaultBinding.Extensions;
SoapFaultBinding mySoapFaultBinding = new SoapFaultBinding();
mySoapFaultBinding.Use = SoapBindingUse.Literal;
mySoapFaultBinding.Namespace = "http://www.contoso.com/stockquote";
myExtensions.Add(mySoapFaultBinding);
myFaultBindingCollection.Add(myFaultBinding);
Dim myFaultBindingCollection As FaultBindingCollection = myOperationBinding.Faults
Dim myFaultBinding As New FaultBinding()
myFaultBinding.Name = "ErrorString"
' Associate SOAP fault binding to the fault binding of the operation.
myExtensions = myFaultBinding.Extensions
Dim mySoapFaultBinding As New SoapFaultBinding()
mySoapFaultBinding.Use = SoapBindingUse.Literal
mySoapFaultBinding.Namespace = "http://www.contoso.com/stockquote"
myExtensions.Add(mySoapFaultBinding)
myFaultBindingCollection.Add(myFaultBinding)

Применяется к

Item[String]

Исходный код:
ServiceDescription.cs
Исходный код:
ServiceDescription.cs
Исходный код:
ServiceDescription.cs

Получает объект FaultBinding, заданный его именем.

public:
 property System::Web::Services::Description::FaultBinding ^ default[System::String ^] { System::Web::Services::Description::FaultBinding ^ get(System::String ^ name); };
public System.Web.Services.Description.FaultBinding this[string name] { get; }
member this.Item(string) : System.Web.Services.Description.FaultBinding
Default Public ReadOnly Property Item(name As String) As FaultBinding

Параметры

name
String

Имя возвращенного объекта FaultBinding.

Значение свойства

FaultBinding.

Примеры

В следующем примере показано типичное использование этого свойства.

BindingCollection^ myBindingCollection = myServiceDescription->Bindings;
Binding^ myBinding = myBindingCollection[ 0 ];
OperationBindingCollection^ myOperationBindingCollection = myBinding->Operations;
OperationBinding^ myOperationBinding = myOperationBindingCollection[ 0 ];
FaultBindingCollection^ myFaultBindingCollection = myOperationBinding->Faults;
if ( myFaultBindingCollection->Contains( myFaultBindingCollection[ "ErrorString" ] ) )
   myFaultBindingCollection->Remove( myFaultBindingCollection[ "ErrorString" ] );
BindingCollection myBindingCollection = myServiceDescription.Bindings;
Binding myBinding = myBindingCollection[0];
OperationBindingCollection myOperationBindingCollection = myBinding.Operations;
OperationBinding myOperationBinding = myOperationBindingCollection[0];
FaultBindingCollection myFaultBindingCollection = myOperationBinding.Faults;
if(myFaultBindingCollection.Contains(myFaultBindingCollection["ErrorString"]))
   myFaultBindingCollection.Remove(myFaultBindingCollection["ErrorString"]);
Dim myBindingCollection As BindingCollection = myServiceDescription.Bindings
Dim myBinding As Binding = myBindingCollection(0)
Dim myOperationBindingCollection As OperationBindingCollection = myBinding.Operations
Dim myOperationBinding As OperationBinding = myOperationBindingCollection(0)
Dim myFaultBindingCollection As FaultBindingCollection = myOperationBinding.Faults
If myFaultBindingCollection.Contains(myFaultBindingCollection("ErrorString")) Then
   myFaultBindingCollection.Remove(myFaultBindingCollection("ErrorString"))
  End If

Применяется к