DiscoveryReferenceCollection クラス
探索された参照のコレクション。このクラスは継承できません。
この型のすべてのメンバの一覧については、DiscoveryReferenceCollection メンバ を参照してください。
System.Object
System.Collections.CollectionBase
System.Web.Services.Discovery.DiscoveryReferenceCollection
NotInheritable Public Class DiscoveryReferenceCollection
Inherits CollectionBase
[C#]
public sealed class DiscoveryReferenceCollection : CollectionBase
[C++]
public __gc __sealed class DiscoveryReferenceCollection : public
CollectionBase
[JScript]
public class DiscoveryReferenceCollection extends CollectionBase
スレッドセーフ
この型の public static (Visual Basicでは Shared) のすべてのメンバは、マルチスレッド操作で安全に使用できます。インスタンスのメンバの場合は、スレッドセーフであるとは限りません。
使用例
Imports System
Imports System.IO
Imports System.Web.Services.Discovery
Class MyDiscoveryDocumentMod
Shared Sub Main()
Try
Dim myDiscoveryDocReference1 As New DiscoveryDocumentReference()
Dim myDiscoveryDocReference2 As New DiscoveryDocumentReference()
Dim myDiscoveryReference As DiscoveryReference
Console.WriteLine("Demonstrating DiscoveryReferenceCollection class.")
' Create new DiscoveryReferenceCollection.
Dim myDiscoveryReferenceCollection As New DiscoveryReferenceCollection()
' Access the Count method.
Console.WriteLine("The number of elements in collection is: " & _
myDiscoveryReferenceCollection.Count.ToString())
' Add elements to the collection.
myDiscoveryReferenceCollection.Add(myDiscoveryDocReference1)
myDiscoveryReferenceCollection.Add(myDiscoveryDocReference2)
Console.WriteLine("The number of elements in the collection " _
& "after adding two elements to the collection: " _
& myDiscoveryReferenceCollection.Count.ToString())
' Call the Contains method.
If myDiscoveryReferenceCollection.Contains(myDiscoveryDocReference1) _
<> True Then
Throw New Exception("Element not found in collection.")
End If
' Access the Item property.
myDiscoveryReference = myDiscoveryReferenceCollection.Item(0)
If myDiscoveryReference Is Nothing Then
Throw New Exception("Element not found in collection.")
End If
' Remove one element from the collection.
myDiscoveryReferenceCollection.Remove(myDiscoveryDocReference1)
Console.WriteLine("The number of elements in collection " _
& "after removing one element is: " _
& myDiscoveryReferenceCollection.Count.ToString())
Catch e As Exception
Console.Writeline("Exception occured : " + e.Message)
End Try
End Sub
End Class
[C#]
using System;
using System.IO;
using System.Web.Services.Discovery;
class MyDiscoveryDocumentClass
{
static void Main()
{
DiscoveryDocumentReference myDiscoveryDocReference1 =
new DiscoveryDocumentReference();
DiscoveryDocumentReference myDiscoveryDocReference2 =
new DiscoveryDocumentReference();
DiscoveryReference myDiscoveryReference;
Console.WriteLine("Demonstrating DiscoveryReferenceCollection class.");
// Create new DiscoveryReferenceCollection.
DiscoveryReferenceCollection myDiscoveryReferenceCollection =
new DiscoveryReferenceCollection();
// Access the Count method.
Console.WriteLine("The number of elements in the collection is: "
+ myDiscoveryReferenceCollection.Count.ToString());
// Add elements to the collection.
myDiscoveryReferenceCollection.Add(myDiscoveryDocReference1);
myDiscoveryReferenceCollection.Add(myDiscoveryDocReference2);
Console.WriteLine("The number of elements in the collection "
+ "after adding two elements to the collection: "
+ myDiscoveryReferenceCollection.Count.ToString());
// Call the Contains method.
if (myDiscoveryReferenceCollection.Contains(myDiscoveryDocReference1)
!= true)
{
throw new Exception("Element not found in collection.");
}
// Access the indexed member.
myDiscoveryReference =
(DiscoveryReference)myDiscoveryReferenceCollection[0];
if (myDiscoveryReference == null)
{
throw new Exception("Element not found in collection.");
}
// Remove one element from collection.
myDiscoveryReferenceCollection.Remove(myDiscoveryDocReference1);
Console.WriteLine("The number of elements in the collection "
+ "after removing one element is: "
+ myDiscoveryReferenceCollection.Count.ToString());
}
}
[C++]
#using <mscorlib.dll>
#using <System.Web.Services.dll>
using namespace System;
using namespace System::IO;
using namespace System::Web::Services::Discovery;
int main() {
DiscoveryDocumentReference* myDiscoveryDocReference1 =
new DiscoveryDocumentReference();
DiscoveryDocumentReference* myDiscoveryDocReference2 =
new DiscoveryDocumentReference();
DiscoveryReference* myDiscoveryReference;
Console::WriteLine(S"Demonstrating DiscoveryReferenceCollection class.");
// Create new DiscoveryReferenceCollection.
DiscoveryReferenceCollection* myDiscoveryReferenceCollection =
new DiscoveryReferenceCollection();
// Access the Count method.
Console::WriteLine(S"The number of elements in the collection is: {0}",
__box(myDiscoveryReferenceCollection->Count));
// Add elements to the collection.
myDiscoveryReferenceCollection->Add(myDiscoveryDocReference1);
myDiscoveryReferenceCollection->Add(myDiscoveryDocReference2);
Console::WriteLine(S"The number of elements in the collection after adding two elements to the collection: {0}",
__box(myDiscoveryReferenceCollection->Count));
// Call the Contains method.
if (myDiscoveryReferenceCollection->Contains(myDiscoveryDocReference1)
!= true) {
throw new Exception(S"Element not found in collection.");
}
// Access the indexed member.
myDiscoveryReference =
dynamic_cast<DiscoveryReference*>(myDiscoveryReferenceCollection->Item[0]);
if (myDiscoveryReference == 0) {
throw new Exception(S"Element not found in collection.");
}
// Remove one element from collection.
myDiscoveryReferenceCollection->Remove(myDiscoveryDocReference1);
Console::WriteLine(S"The number of elements in the collection after removing one element is: {0}",
__box(myDiscoveryReferenceCollection->Count));
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
名前空間: System.Web.Services.Discovery
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
アセンブリ: System.Web.Services (System.Web.Services.dll 内)
参照
DiscoveryReferenceCollection メンバ | System.Web.Services.Discovery 名前空間