MessageCollection.Item Property (Int32)

Gets or sets the value of a Message at the specified zero-based index.

Namespace: System.Web.Services.Description
Assembly: System.Web.Services (in system.web.services.dll)

public:
property Message^ default [int] {
	Message^ get (int index);
	void set (int index, Message^ value);
}
/** @property */
public Message get_Item (int index)

/** @property */
public void set_Item (int index, Message value)

Not applicable.

Parameters

index

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

Property Value

A Message.

The following example demonstrates the use of a zero-based index to iterate through the members of a MessageCollection.

// Get Message Collection.
MessageCollection^ myMessageCollection = myServiceDescription->Messages;
Console::WriteLine( "Total Messages in the document = {0}", myServiceDescription->Messages->Count );
Console::WriteLine( "" );
Console::WriteLine( "Enumerating Messages..." );
Console::WriteLine( "" );

// Print messages to console.
for ( int i = 0; i < myMessageCollection->Count; ++i )
   Console::WriteLine( "Message Name : {0}", myMessageCollection[ i ]->Name );

// Get Message Collection.
MessageCollection myMessageCollection = 
    myServiceDescription.get_Messages();
Console.WriteLine("Total Messages in the document = " 
    + myServiceDescription.get_Messages().get_Count());
Console.WriteLine("");
Console.WriteLine("Enumerating Messages...");
Console.WriteLine("");

// Print messages to console.
for (int i = 0; i < myMessageCollection.get_Count(); ++i) {
    Console.WriteLine("Message Name : " 
        + myMessageCollection.get_Item(i).get_Name());
}

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.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show: