Udostępnij za pośrednictwem


MessageCollection.Item[] Właściwość

Definicja

Pobiera lub ustawia Message wystąpienie określone przez przekazany parametr.

Przeciążenia

Item[Int32]

Pobiera lub ustawia wartość dla określonego Message indeksu opartego na zerze.

Item[String]

Message Pobiera określony przez jego nazwę.

Item[Int32]

Źródło:
ServiceDescription.cs
Źródło:
ServiceDescription.cs
Źródło:
ServiceDescription.cs

Pobiera lub ustawia wartość dla określonego Message indeksu opartego na zerze.

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

Parametry

index
Int32

Indeks oparty na zerze, Message którego wartość jest modyfikowana lub zwracana.

Wartość właściwości

Klasa Message.

Przykłady

W poniższym przykładzie pokazano użycie indeksu opartego na zerach do iteracji po elementach członkowskich klasy 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.Messages;
Console.WriteLine("Total Messages in the document = " + 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 : " + myMessageCollection[i].Name);
}
' Get Message Collection.
Dim myMessageCollection As MessageCollection = myServiceDescription.Messages
Console.WriteLine("Total Messages in the document = " + _
                        myServiceDescription.Messages.Count.ToString)
Console.WriteLine("")
Console.WriteLine("Enumerating Messages...")
Console.WriteLine("")
' Print messages to console.
Dim i As Integer
For i = 0 To myMessageCollection.Count - 1
   Console.WriteLine("Message Name : " + myMessageCollection(i).Name)
Next

Dotyczy

Item[String]

Źródło:
ServiceDescription.cs
Źródło:
ServiceDescription.cs
Źródło:
ServiceDescription.cs

Message Pobiera określony przez jego nazwę.

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

Parametry

name
String

Nazwa zwróconego Message elementu.

Wartość właściwości

Klasa Message.

Przykłady

W poniższym przykładzie pokazano użycie ciągu do pobrania .Message

// Get Message by Name = S"AddSoapIn".
Message^ myMessage = myServiceDescription->Messages[ "AddSoapIn" ];
Console::WriteLine( "" );
Console::WriteLine( "Getting Message = 'AddSoapIn' {by Name}" );
if ( myMessageCollection->Contains( myMessage ) )
{
   Console::WriteLine( "" );

   // Get Message Name = S"AddSoapIn" Index.
   Console::WriteLine( "Message 'AddSoapIn' was found in Message Collection." );
   Console::WriteLine( "Index of 'AddSoapIn' in Message Collection = {0}", myMessageCollection->IndexOf( myMessage ) );
   Console::WriteLine( "Deleting Message from Message Collection..." );
   myMessageCollection->Remove( myMessage );
   if ( myMessageCollection->IndexOf( myMessage ) == -1 )
         Console::WriteLine( "Message 'AddSoapIn' was successfully removed from Message Collection." );
}
// Get Message by Name = "AddSoapIn".
Message myMessage = myServiceDescription.Messages["AddSoapIn"];
Console.WriteLine("");
Console.WriteLine("Getting Message = 'AddSoapIn' {by Name}");
if (myMessageCollection.Contains(myMessage))
{
   Console.WriteLine("");
   // Get Message Name = "AddSoapIn" Index.
   Console.WriteLine("Message 'AddSoapIn' was found in Message Collection.");
   Console.WriteLine("Index of 'AddSoapIn' in Message Collection = " + myMessageCollection.IndexOf(myMessage));
   Console.WriteLine("Deleting Message from Message Collection...");
   myMessageCollection.Remove(myMessage);
   if(myMessageCollection.IndexOf(myMessage) == -1)
   {
      Console.WriteLine("Message 'AddSoapIn' was successfully removed from Message Collection.");
   }
}
' Get Message by Name = "AddSoapIn".
Dim myMessage As Message = myServiceDescription.Messages("AddSoapIn")
Console.WriteLine("")
Console.WriteLine("Getting Message = 'AddSoapIn' {by Name}")
If myMessageCollection.Contains(myMessage) Then
   Console.WriteLine("")
   ' Get Message Name = "AddSoapIn" Index.
   Console.WriteLine("Message 'AddSoapIn' was found in Message Collection.")
   Console.WriteLine("Index of 'AddSoapIn' in Message Collection = " + _
                     myMessageCollection.IndexOf(myMessage).ToString)
   Console.WriteLine("Deleting Message from Message Collection...")
   myMessageCollection.Remove(myMessage)
   If myMessageCollection.IndexOf(myMessage) = -1 Then
      Console.WriteLine("Message 'AddSoapIn' was successfully " + _
                        " removed from Message Collection.")
   End If
End If

Dotyczy