ServiceDescriptionFormatExtensionCollection 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
XML Web services에서 사용되는 확장 요소의 컬렉션을 나타냅니다. 이 클래스는 상속될 수 없습니다.
public ref class ServiceDescriptionFormatExtensionCollection sealed : System::Web::Services::Description::ServiceDescriptionBaseCollection
public sealed class ServiceDescriptionFormatExtensionCollection : System.Web.Services.Description.ServiceDescriptionBaseCollection
type ServiceDescriptionFormatExtensionCollection = class
inherit ServiceDescriptionBaseCollection
Public NotInheritable Class ServiceDescriptionFormatExtensionCollection
Inherits ServiceDescriptionBaseCollection
- 상속
예제
#using <System.Web.Services.dll>
#using <System.Xml.dll>
using namespace System;
using namespace System::Web::Services::Description;
using namespace System::Collections;
ref class MyFormatExtension: public ServiceDescriptionFormatExtension
{
public:
MyFormatExtension()
{
// Set the properties.
this->Handled = true;
this->Required = true;
}
};
int main()
{
try
{
ServiceDescription^ myServiceDescription = ServiceDescription::Read( "Sample_cpp.wsdl" );
ServiceDescriptionFormatExtensionCollection^ myCollection = gcnew ServiceDescriptionFormatExtensionCollection( myServiceDescription );
SoapBinding^ mySoapBinding1 = gcnew SoapBinding;
SoapBinding^ mySoapBinding2 = gcnew SoapBinding;
SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding;
MyFormatExtension^ myFormatExtensionObject = gcnew MyFormatExtension;
// Add elements to collection.
myCollection->Add( mySoapBinding1 );
myCollection->Add( mySoapAddressBinding );
myCollection->Add( mySoapBinding2 );
myCollection->Add( myFormatExtensionObject );
Console::WriteLine( "Collection contains following types of elements: " );
// Display the 'Type' of the elements in collection.
for ( int i = 0; i < myCollection->Count; i++ )
Console::WriteLine( myCollection[ i ]->GetType() );
// Check element of type 'SoapAddressBinding' in collection.
Object^ myObj = myCollection->Find( mySoapAddressBinding->GetType() );
if ( myObj == nullptr )
Console::WriteLine( "Element of type ' {0}' not found in collection.", mySoapAddressBinding->GetType() );
else
Console::WriteLine( "Element of type ' {0}' found in collection.", mySoapAddressBinding->GetType() );
// Check all elements of type 'SoapBinding' in collection.
array<Object^>^myObjectArray1 = gcnew array<Object^>(myCollection->Count);
myObjectArray1 = myCollection->FindAll( mySoapBinding1->GetType() );
int myNumberOfElements = 0;
IEnumerator^ myIEnumerator = myObjectArray1->GetEnumerator();
// Calculate number of elements of type 'SoapBinding'.
while ( myIEnumerator->MoveNext() )
if ( mySoapBinding1->GetType() == myIEnumerator->Current->GetType() )
myNumberOfElements++;
Console::WriteLine( "Collection contains {0} objects of type ' {1}'.", myNumberOfElements, mySoapBinding1->GetType() );
// Check 'IsHandled' status for 'myFormatExtensionObject' object in collection.
Console::WriteLine( "'IsHandled' status for {0} object is {1}.", myFormatExtensionObject, myCollection->IsHandled( myFormatExtensionObject ) );
// Check 'IsRequired' status for 'myFormatExtensionObject' object in collection.
Console::WriteLine( "'IsRequired' status for {0} object is {1}.", myFormatExtensionObject, myCollection->IsRequired( myFormatExtensionObject ) );
// Copy elements of collection to an Object array.
array<Object^>^myObjectArray2 = gcnew array<Object^>(myCollection->Count);
myCollection->CopyTo( myObjectArray2, 0 );
Console::WriteLine( "Collection elements are copied to an object array." );
// Check for 'myFormatExtension' object in collection.
if ( myCollection->Contains( myFormatExtensionObject ) )
{
// Get index of a 'myFormatExtension' object in collection.
Console::WriteLine( "Index of 'myFormatExtensionObject' is {0} in collection.", myCollection->IndexOf( myFormatExtensionObject ) );
// Remove 'myFormatExtensionObject' element from collection.
myCollection->Remove( myFormatExtensionObject );
Console::WriteLine( "'myFormatExtensionObject' is removed from collection." );
}
// Insert 'MyFormatExtension' object.
myCollection->Insert( 0, myFormatExtensionObject );
Console::WriteLine( "'myFormatExtensionObject' is inserted to collection." );
}
catch ( Exception^ e )
{
Console::WriteLine( "The following exception was raised: {0}", e->Message );
}
}
using System;
using System.Web.Services.Description;
using System.Collections;
class MyFormatExtension : ServiceDescriptionFormatExtension
{
public MyFormatExtension()
{
// Set the properties.
this.Handled = true;
this.Required = true;
}
}
class myCollectionSample
{
static void Main()
{
try
{
ServiceDescription myServiceDescription =
ServiceDescription.Read("Sample_CS.wsdl");
ServiceDescriptionFormatExtensionCollection myCollection =
new ServiceDescriptionFormatExtensionCollection(myServiceDescription);
SoapBinding mySoapBinding1 = new SoapBinding();
SoapBinding mySoapBinding2 = new SoapBinding();
SoapAddressBinding mySoapAddressBinding = new SoapAddressBinding();
MyFormatExtension myFormatExtensionObject = new MyFormatExtension();
// Add elements to collection.
myCollection.Add(mySoapBinding1);
myCollection.Add(mySoapAddressBinding);
myCollection.Add(mySoapBinding2);
myCollection.Add(myFormatExtensionObject);
Console.WriteLine("Collection contains following types of elements: ");
// Display the 'Type' of the elements in collection.
for(int i = 0;i< myCollection.Count;i++)
{
Console.WriteLine(myCollection[i].GetType().ToString());
}
// Check element of type 'SoapAddressBinding' in collection.
Object myObj = myCollection.Find(mySoapAddressBinding.GetType());
if(myObj == null)
{
Console.WriteLine("Element of type '{0}' not found in collection.",
mySoapAddressBinding.GetType().ToString());
}
else
{
Console.WriteLine("Element of type '{0}' found in collection.",
mySoapAddressBinding.GetType().ToString());
}
// Check all elements of type 'SoapBinding' in collection.
Object[] myObjectArray1 = new Object[myCollection.Count];
myObjectArray1 = myCollection.FindAll(mySoapBinding1.GetType());
int myNumberOfElements = 0;
IEnumerator myIEnumerator = myObjectArray1.GetEnumerator();
// Calculate number of elements of type 'SoapBinding'.
while(myIEnumerator.MoveNext())
{
if(mySoapBinding1.GetType() == myIEnumerator.Current.GetType())
myNumberOfElements++;
}
Console.WriteLine("Collection contains {0} objects of type '{1}'.",
myNumberOfElements.ToString(),
mySoapBinding1.GetType().ToString());
// Check 'IsHandled' status for 'myFormatExtensionObject' object in collection.
Console.WriteLine("'IsHandled' status for {0} object is {1}.",
myFormatExtensionObject.ToString(),
myCollection.IsHandled(myFormatExtensionObject).ToString());
// Check 'IsRequired' status for 'myFormatExtensionObject' object in collection.
Console.WriteLine("'IsRequired' status for {0} object is {1}.",
myFormatExtensionObject.ToString(),
myCollection.IsRequired(myFormatExtensionObject).ToString());
// Copy elements of collection to an Object array.
Object[] myObjectArray2 = new Object[myCollection.Count];
myCollection.CopyTo(myObjectArray2,0);
Console.WriteLine("Collection elements are copied to an object array.");
// Check for 'myFormatExtension' object in collection.
if(myCollection.Contains(myFormatExtensionObject))
{
// Get index of a 'myFormatExtension' object in collection.
Console.WriteLine("Index of 'myFormatExtensionObject' is "+
"{0} in collection.",
myCollection.IndexOf(myFormatExtensionObject).ToString());
// Remove 'myFormatExtensionObject' element from collection.
myCollection.Remove(myFormatExtensionObject);
Console.WriteLine("'myFormatExtensionObject' is removed"+
" from collection.");
}
// Insert 'MyFormatExtension' object.
myCollection.Insert(0,myFormatExtensionObject);
Console.WriteLine("'myFormatExtensionObject' is inserted to collection.");
}
catch(Exception e)
{
Console.WriteLine("The following exception was raised: {0}", e.Message);
}
}
}
Imports System.Web.Services.Description
Imports System.Collections
Class MyFormatExtension
Inherits ServiceDescriptionFormatExtension
Public Sub New()
' Set the properties.
Me.Handled = True
Me.Required = True
End Sub
End Class
Class myCollectionSample
Shared Sub Main()
Try
Dim myServiceDescription As ServiceDescription = _
ServiceDescription.Read("Sample_VB.wsdl")
Dim myCollection As New ServiceDescriptionFormatExtensionCollection(myServiceDescription)
Dim mySoapBinding1 As New SoapBinding()
Dim mySoapBinding2 As New SoapBinding()
Dim mySoapAddressBinding As New SoapAddressBinding()
Dim myFormatExtensionObject As New MyFormatExtension()
' Add elements to collection.
myCollection.Add(mySoapBinding1)
myCollection.Add(mySoapAddressBinding)
myCollection.Add(mySoapBinding2)
myCollection.Add(myFormatExtensionObject)
Console.WriteLine("Collection contains following types of elements: ")
' Display the 'Type' of the elements in collection.
Dim i As Integer
For i = 0 To myCollection.Count - 1
Console.WriteLine(myCollection(i).GetType().ToString())
Next i
' Check element of type 'SoapAddressBinding' in collection.
Dim myObj As Object = myCollection.Find(mySoapAddressBinding.GetType())
If myObj Is Nothing Then
Console.WriteLine("Element of type '{0}' not found in collection.", _
mySoapAddressBinding.GetType().ToString())
Else
Console.WriteLine("Element of type '{0}' found in collection.", _
mySoapAddressBinding.GetType().ToString())
End If
' Check all elements of type 'SoapBinding' in collection.
Dim myObjectArray1(myCollection.Count -1 ) As Object
myObjectArray1 = myCollection.FindAll(mySoapBinding1.GetType())
Dim myNumberOfElements As Integer = 0
Dim myIEnumerator As IEnumerator = myObjectArray1.GetEnumerator()
' Calculate number of elements of type 'SoapBinding'.
While myIEnumerator.MoveNext()
If mySoapBinding1.GetType() Is myIEnumerator.Current.GetType() Then
myNumberOfElements += 1
End If
End While
Console.WriteLine("Collection contains {0} objects of type '{1}'.", _
myNumberOfElements.ToString(), mySoapBinding1.GetType().ToString())
' Check 'IsHandled' status for 'myFormatExtensionObject' object in collection.
Console.WriteLine("'IsHandled' status for {0} object is {1}.", _
myFormatExtensionObject.ToString(), _
myCollection.IsHandled(myFormatExtensionObject).ToString())
' Check 'IsRequired' status for 'myFormatExtensionObject' object in collection.
Console.WriteLine("'IsRequired' status for {0} object is {1}.", _
myFormatExtensionObject.ToString(), _
myCollection.IsRequired(myFormatExtensionObject).ToString())
' Copy elements of collection to an Object array.
Dim myObjectArray2(myCollection.Count -1 ) As Object
myCollection.CopyTo(myObjectArray2, 0)
Console.WriteLine("Collection elements are copied to an object array.")
' Check for 'myFormatExtension' object in collection.
If myCollection.Contains(myFormatExtensionObject) Then
' Get index of a 'myFormatExtension' object in collection.
Console.WriteLine("Index of 'myFormatExtensionObject' is " + _
"{0} in collection.", myCollection.IndexOf(myFormatExtensionObject).ToString())
' Remove 'myFormatExtensionObject' element from collection.
myCollection.Remove(myFormatExtensionObject)
Console.WriteLine("'myFormatExtensionObject' is removed" + _
" from collection.")
End If
' Insert 'MyFormatExtension' object.
myCollection.Insert(0, myFormatExtensionObject)
Console.WriteLine("'myFormatExtensionObject' is inserted to collection.")
Catch e As Exception
Console.WriteLine("The following exception was raised: {0}", e.Message.ToString())
End Try
End Sub
End Class
설명
이 컬렉션에서 파생 된 클래스의 인스턴스를 포함 될 수 있습니다 ServiceDescriptionFormatExtension, 또는 인스턴스는 XmlElement 클래스입니다. 파생된 클래스에서 ServiceDescriptionFormatExtension 클래스 WSDL 웹 서비스 설명 언어 () 사양에 정의 된 것 외에도 확장성 요소를 정의할 수 있습니다. 사용 하 여 프로그램 ServiceDescriptionFormatExtensionCollection 만들려는 확장성 요소의 형식을 미리 알고 있는 경우. 사용 하 여는 XmlElement 때 알 수 없는 요소 형식의 사전입니다.
생성자
ServiceDescriptionFormatExtensionCollection(Object) |
ServiceDescriptionFormatExtensionCollection 클래스의 새 인스턴스를 초기화합니다. |
속성
Capacity |
CollectionBase에 포함될 수 있는 요소의 수를 가져오거나 설정합니다. (다음에서 상속됨 CollectionBase) |
Count |
CollectionBase 인스턴스에 포함된 요소 수를 가져옵니다. 이 속성은 재정의할 수 없습니다. (다음에서 상속됨 CollectionBase) |
InnerList |
ArrayList 인스턴스의 요소 목록을 포함하는 CollectionBase를 가져옵니다. (다음에서 상속됨 CollectionBase) |
Item[Int32] |
ServiceDescriptionFormatExtensionCollection 멤버의 값을 가져오거나 설정합니다. |
List |
IList 인스턴스의 요소 목록을 포함하는 CollectionBase를 가져옵니다. (다음에서 상속됨 CollectionBase) |
Table |
ServiceDescriptionBaseCollection에서 키와 값의 연결을 구현하는 인터페이스를 가져옵니다. (다음에서 상속됨 ServiceDescriptionBaseCollection) |
메서드
명시적 인터페이스 구현
확장 메서드
Cast<TResult>(IEnumerable) |
IEnumerable의 요소를 지정된 형식으로 캐스팅합니다. |
OfType<TResult>(IEnumerable) |
지정된 형식에 따라 IEnumerable의 요소를 필터링합니다. |
AsParallel(IEnumerable) |
쿼리를 병렬화할 수 있도록 합니다. |
AsQueryable(IEnumerable) |
IEnumerable을 IQueryable로 변환합니다. |