This documentation is archived and is not being maintained.

OperationMessageCollection.Item Property

Gets or sets the value of an OperationMessage at the specified zero-based index.

[C#] In C#, this property is the indexer for the OperationMessageCollection class.

[Visual Basic]
Public Default Property Item( _
   ByVal index As Integer _
) As OperationMessage
[C#]
public OperationMessage this[
 int index
] {get; set;}
[C++]
public: __property OperationMessage* get_Item(
 int index
);
public: __property void set_Item(
 int index,
   OperationMessage*
);
[JScript]
returnValue = OperationMessageCollectionObject.Item(index);
OperationMessageCollectionObject.Item(index) = returnValue;
-or-
returnValue = OperationMessageCollectionObject(index);
OperationMessageCollectionObject(index) = returnValue;

[JScript] In JScript, you can use the default indexed properties defined by a type, but you cannot explicitly define your own. However, specifying the expando attribute on a class automatically provides a default indexed property whose type is Object and whose index type is String.

Arguments [JScript]

index
The zero-based index of the OperationMessage whose value is modified or returned.

Parameters [Visual Basic, C#, C++]

index
The zero-based index of the OperationMessage whose value is modified or returned.

Property Value

An OperationMessage.

Example

[Visual Basic] 
' Get the operation message for the Add operation.
Dim myOperationMessage As OperationMessage = _
   myOperationMessageCollection.Item(0)
Dim myInputOperationMessage As OperationMessage = _
   CType(New OperationInput(), OperationMessage)
Dim myXmlQualifiedName As _
   New XmlQualifiedName("AddSoapIn", myDescription.TargetNamespace)
myInputOperationMessage.Message = myXmlQualifiedName

Dim myCollection(myOperationMessageCollection.Count -1 ) _
   As OperationMessage
myOperationMessageCollection.CopyTo(myCollection, 0)
Console.WriteLine("Operation name(s) :")
Dim i As Integer
For i = 0 To myCollection.Length - 1
   Console.WriteLine(" " & myCollection(i).Operation.Name)
Next i

' Add the OperationMessage to the collection.
myOperationMessageCollection.Add(myInputOperationMessage)
DisplayFlowInputOutput(myOperationMessageCollection, "Add")

If myOperationMessageCollection.Contains(myOperationMessage) _
   = True Then
   Dim myIndex As Integer = _
      myOperationMessageCollection.IndexOf(myOperationMessage)
   Console.WriteLine(" The index of the Add operation " & _
       "message in the collection is : " & myIndex.ToString())
End If

[C#] 
// Get the operation message for the Add operation.
OperationMessage myOperationMessage =
   myOperationMessageCollection[0];
OperationMessage myInputOperationMessage =
   (OperationMessage) new OperationInput();
XmlQualifiedName myXmlQualifiedName = new XmlQualifiedName(
   "AddSoapIn", myDescription.TargetNamespace);
myInputOperationMessage.Message = myXmlQualifiedName;

OperationMessage[] myCollection = 
   new OperationMessage[myOperationMessageCollection.Count];
myOperationMessageCollection.CopyTo(myCollection, 0);
Console.WriteLine("Operation name(s) :");
for (int i = 0; i < myCollection.Length ; i++)
{
   Console.WriteLine(" " + myCollection[i].Operation.Name);
}

// Add the OperationMessage to the collection.
myOperationMessageCollection.Add(myInputOperationMessage);
DisplayFlowInputOutput(myOperationMessageCollection, "Add");

if(myOperationMessageCollection.Contains(myOperationMessage) 
   == true )
{
   int myIndex =
      myOperationMessageCollection.IndexOf(myOperationMessage);
   Console.WriteLine(" The index of the Add operation " +
      "message in the collection is : " + myIndex);
}

[C++] 
// Get the operation message for the Add operation.
OperationMessage* myOperationMessage =
   myOperationMessageCollection->Item[0];
OperationMessage* myInputOperationMessage =
   dynamic_cast<OperationMessage*> (new OperationInput());
XmlQualifiedName* myXmlQualifiedName = new XmlQualifiedName(
   S"AddSoapIn", myDescription->TargetNamespace);
myInputOperationMessage->Message = myXmlQualifiedName;

OperationMessage* myCollection[] = 
   new OperationMessage*[myOperationMessageCollection->Count];
myOperationMessageCollection->CopyTo(myCollection, 0);
Console::WriteLine(S"Operation name(s) :");
for (int i = 0; i < myCollection->Length ; i++)
{
   Console::WriteLine(S" {0}", myCollection[i]->Operation->Name);
}

// Add the OperationMessage to the collection.
myOperationMessageCollection->Add(myInputOperationMessage);
DisplayFlowInputOutput(myOperationMessageCollection, S"Add");

if(myOperationMessageCollection->Contains(myOperationMessage) 
   == true )
{
   int myIndex =
      myOperationMessageCollection->IndexOf(myOperationMessage);
   Console::WriteLine(S" The index of the Add operation message in the collection is : {0}", __box(myIndex));
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

OperationMessageCollection Class | OperationMessageCollection Members | System.Web.Services.Description Namespace

Show: