OperationCollection クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
Operation クラスのインスタンスのコレクションを表します。 このクラスは継承できません。
public ref class OperationCollection sealed : System::Web::Services::Description::ServiceDescriptionBaseCollection
public sealed class OperationCollection : System.Web.Services.Description.ServiceDescriptionBaseCollection
type OperationCollection = class
inherit ServiceDescriptionBaseCollection
Public NotInheritable Class OperationCollection
Inherits ServiceDescriptionBaseCollection
- 継承
例
次の例では、 クラスによって公開されるプロパティとメソッドの使用方法を OperationCollection
示します。
#using <System.dll>
#using <System.Xml.dll>
#using <System.Web.Services.dll>
using namespace System;
using namespace System::Web::Services;
using namespace System::Xml;
using namespace System::Web::Services::Description;
int main()
{
try
{
// Read the 'MathService_Input_cs.wsdl' file.
ServiceDescription^ myDescription = ServiceDescription::Read( "MathService_Input_cs.wsdl" );
PortTypeCollection^ myPortTypeCollection = myDescription->PortTypes;
// Get the 'OperationCollection' for 'SOAP' protocol.
OperationCollection^ myOperationCollection = myPortTypeCollection[ 0 ]->Operations;
Operation^ myOperation = gcnew Operation;
myOperation->Name = "Add";
OperationMessage^ myOperationMessageInput = (OperationMessage^)(gcnew OperationInput);
myOperationMessageInput->Message = gcnew XmlQualifiedName( "AddSoapIn",myDescription->TargetNamespace );
OperationMessage^ myOperationMessageOutput = (OperationMessage^)(gcnew OperationOutput);
myOperationMessageOutput->Message = gcnew XmlQualifiedName( "AddSoapOut",myDescription->TargetNamespace );
myOperation->Messages->Add( myOperationMessageInput );
myOperation->Messages->Add( myOperationMessageOutput );
myOperationCollection->Add( myOperation );
if ( myOperationCollection->Contains( myOperation ) == true )
{
Console::WriteLine( "The index of the added 'myOperation' operation is : {0}", myOperationCollection->IndexOf( myOperation ) );
}
myOperationCollection->Remove( myOperation );
// Insert the 'myOpearation' operation at the index '0'.
myOperationCollection->Insert( 0, myOperation );
Console::WriteLine( "The operation at index '0' is : {0}", myOperationCollection[ 0 ]->Name );
array<Operation^>^myOperationArray = gcnew array<Operation^>(myOperationCollection->Count);
myOperationCollection->CopyTo( myOperationArray, 0 );
Console::WriteLine( "The operation(s) in the collection are :" );
for ( int i = 0; i < myOperationCollection->Count; i++ )
{
Console::WriteLine( " {0}", myOperationArray[ i ]->Name );
}
myDescription->Write( "MathService_New_cs.wsdl" );
}
catch ( Exception^ e )
{
Console::WriteLine( "Exception caught!!!" );
Console::WriteLine( "Source : {0}", e->Source );
Console::WriteLine( "Message : {0}", e->Message );
}
}
using System;
using System.Web.Services;
using System.Xml;
using System.Web.Services.Description;
class MyOperationCollectionSample
{
public static void Main()
{
try
{
// Read the 'MathService_Input_cs.wsdl' file.
ServiceDescription myDescription =
ServiceDescription.Read("MathService_Input_cs.wsdl");
PortTypeCollection myPortTypeCollection =myDescription.PortTypes;
// Get the 'OperationCollection' for 'SOAP' protocol.
OperationCollection myOperationCollection =
myPortTypeCollection[0].Operations;
Operation myOperation = new Operation();
myOperation.Name = "Add";
OperationMessage myOperationMessageInput =
(OperationMessage) new OperationInput();
myOperationMessageInput.Message = new XmlQualifiedName
("AddSoapIn",myDescription.TargetNamespace);
OperationMessage myOperationMessageOutput =
(OperationMessage) new OperationOutput();
myOperationMessageOutput.Message = new XmlQualifiedName(
"AddSoapOut",myDescription.TargetNamespace);
myOperation.Messages.Add(myOperationMessageInput);
myOperation.Messages.Add(myOperationMessageOutput);
myOperationCollection.Add(myOperation);
if(myOperationCollection.Contains(myOperation) == true)
{
Console.WriteLine("The index of the added 'myOperation' " +
"operation is : " +
myOperationCollection.IndexOf(myOperation));
}
myOperationCollection.Remove(myOperation);
// Insert the 'myOpearation' operation at the index '0'.
myOperationCollection.Insert(0, myOperation);
Console.WriteLine("The operation at index '0' is : " +
myOperationCollection[0].Name);
Operation[] myOperationArray = new Operation[
myOperationCollection.Count];
myOperationCollection.CopyTo(myOperationArray, 0);
Console.WriteLine("The operation(s) in the collection are :");
for(int i = 0; i < myOperationCollection.Count; i++)
{
Console.WriteLine(" " + myOperationArray[i].Name);
}
myDescription.Write("MathService_New_cs.wsdl");
}
catch(Exception e)
{
Console.WriteLine("Exception caught!!!");
Console.WriteLine("Source : " + e.Source);
Console.WriteLine("Message : " + e.Message);
}
}
}
Option Strict On
Imports System.Web.Services
Imports System.Xml
Imports System.Web.Services.Description
Class MyOperationCollectionSample
Public Shared Sub Main()
Try
' Read the 'MathService_Input_vb.wsdl' file.
Dim myDescription As ServiceDescription = _
ServiceDescription.Read("MathService_Input_vb.wsdl")
Dim myPortTypeCollection As PortTypeCollection = _
myDescription.PortTypes
' Get the 'OperationCollection' for 'SOAP' protocol.
Dim myOperationCollection As OperationCollection = _
myPortTypeCollection(0).Operations
Dim myOperation As New Operation()
myOperation.Name = "Add"
Dim myOperationMessageInput As OperationMessage = _
CType(New OperationInput(), OperationMessage)
myOperationMessageInput.Message = New XmlQualifiedName _
("AddSoapIn", myDescription.TargetNamespace)
Dim myOperationMessageOutput As OperationMessage = _
CType(New OperationOutput(), OperationMessage)
myOperationMessageOutput.Message = New XmlQualifiedName _
("AddSoapOut", myDescription.TargetNamespace)
myOperation.Messages.Add(myOperationMessageInput)
myOperation.Messages.Add(myOperationMessageOutput)
myOperationCollection.Add(myOperation)
If myOperationCollection.Contains(myOperation) = True Then
Console.WriteLine("The index of the added 'myOperation' " + _
"operation is : " + _
myOperationCollection.IndexOf(myOperation).ToString)
End If
myOperationCollection.Remove(myOperation)
' Insert the 'myOpearation' operation at the index '0'.
myOperationCollection.Insert(0, myOperation)
Console.WriteLine("The operation at index '0' is : " + _
myOperationCollection.Item(0).Name)
Dim myOperationArray(myOperationCollection.Count) As Operation
myOperationCollection.CopyTo(myOperationArray, 0)
Console.WriteLine("The operation(s) in the collection are :")
Dim i As Integer
For i = 0 To myOperationCollection.Count - 1
Console.WriteLine(" " + myOperationArray(i).Name)
Next i
myDescription.Write("MathService_New_vb.wsdl")
Catch e As Exception
Console.WriteLine("Exception caught!!!")
Console.WriteLine("Source : " + e.Source)
Console.WriteLine("Message : " + e.Message)
End Try
End Sub
End Class
注釈
クラスは Operation 、 要素で囲まれた Web サービス記述言語 (WSDL) <operation>
要素に <portType>
対応します。 WSDL の詳細については、WSDL 仕様を参照してください。
プロパティ
Capacity |
CollectionBase に格納できる要素の数を取得または設定します。 (継承元 CollectionBase) |
Count |
CollectionBase インスタンスに含まれる要素の数を取得します。 このプロパティはオーバーライドできません。 (継承元 CollectionBase) |
InnerList |
ArrayList インスタンス内の要素のリストを格納する CollectionBase を取得します。 (継承元 CollectionBase) |
Item[Int32] |
指定した 0 から始まるインデックス番号にある Operation の値を取得または設定します。 |
List |
IList インスタンス内の要素のリストを格納する CollectionBase を取得します。 (継承元 CollectionBase) |
Table |
ServiceDescriptionBaseCollection 内のキーと値の関連付けを実装するインターフェイスを取得します。 (継承元 ServiceDescriptionBaseCollection) |
メソッド
明示的なインターフェイスの実装
拡張メソッド
Cast<TResult>(IEnumerable) |
IEnumerable の要素を、指定した型にキャストします。 |
OfType<TResult>(IEnumerable) |
指定された型に基づいて IEnumerable の要素をフィルター処理します。 |
AsParallel(IEnumerable) |
クエリの並列化を有効にします。 |
AsQueryable(IEnumerable) |
IEnumerable を IQueryable に変換します。 |
適用対象
.NET