OperationFaultCollection.Add(OperationFault) 方法

定义

将指定的 OperationFault 添加到 OperationFaultCollection 的结尾。

public:
 int Add(System::Web::Services::Description::OperationFault ^ operationFaultMessage);
public int Add (System.Web.Services.Description.OperationFault operationFaultMessage);
member this.Add : System.Web.Services.Description.OperationFault -> int
Public Function Add (operationFaultMessage As OperationFault) As Integer

参数

operationFaultMessage
OperationFault

要添加到集合中的 OperationFault

返回

添加了 operationFaultMessage 参数的位置的从零开始的索引。

示例

OperationFaultCollection^ myOperationFaultCollection = myOperation->Faults;
OperationFault^ myOperationFault = gcnew OperationFault;
myOperationFault->Name = "ErrorString";
myOperationFault->Message = gcnew XmlQualifiedName( "s0:GetTradePriceStringFault" );
myOperationFaultCollection->Add( myOperationFault );
OperationFaultCollection myOperationFaultCollection = myOperation.Faults;
OperationFault myOperationFault = new OperationFault();
myOperationFault.Name = "ErrorString";
myOperationFault.Message = new XmlQualifiedName("s0:GetTradePriceStringFault");
myOperationFaultCollection.Add(myOperationFault);
Dim myOperationFaultCollection As OperationFaultCollection = myOperation.Faults
Dim myOperationFault As New OperationFault()
myOperationFault.Name = "ErrorString"
myOperationFault.Message = New XmlQualifiedName("s0:GetTradePriceStringFault")
myOperationFaultCollection.Add(myOperationFault)

适用于