DiscoveryClientReferenceCollection 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示 DiscoveryReference 对象集合。 此类不能被继承。
public ref class DiscoveryClientReferenceCollection sealed : System::Collections::DictionaryBase
public sealed class DiscoveryClientReferenceCollection : System.Collections.DictionaryBase
type DiscoveryClientReferenceCollection = class
inherit DictionaryBase
Public NotInheritable Class DiscoveryClientReferenceCollection
Inherits DictionaryBase
- 继承
示例
#using <System.dll>
#using <System.Web.Services.dll>
using namespace System;
using namespace System::Net;
using namespace System::Collections;
using namespace System::Web::Services::Discovery;
int main()
{
DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol;
myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials;
// 'dataservice.vsdisco' is a sample discovery document.
String^ myStringUrl = "http://localhost/dataservice.vsdisco";
// Call the Discover method to populate the References property.
DiscoveryDocument^ myDiscoveryDocument = myDiscoveryClientProtocol->Discover( myStringUrl );
// Resolve all references found in the discovery document.
myDiscoveryClientProtocol->ResolveAll();
DiscoveryClientReferenceCollection^ myDiscoveryClientReferenceCollection = myDiscoveryClientProtocol->References;
// Retrieve the keys from the collection.
ICollection^ myCollection = myDiscoveryClientReferenceCollection->Keys;
array<Object^>^myObjectCollection = gcnew array<Object^>(myDiscoveryClientReferenceCollection->Count);
myCollection->CopyTo( myObjectCollection, 0 );
Console::WriteLine( "The discovery documents, service descriptions, and XML schema" );
Console::WriteLine( " definitions in the collection are: " );
for ( int i = 0; i < myObjectCollection->Length; i++ )
{
Console::WriteLine( myObjectCollection[ i ] );
}
Console::WriteLine( "" );
// Retrieve the values from the collection.
ICollection^ myCollection1 = myDiscoveryClientReferenceCollection->Values;
array<Object^>^myObjectCollection1 = gcnew array<Object^>(myDiscoveryClientReferenceCollection->Count);
myCollection1->CopyTo( myObjectCollection1, 0 );
Console::WriteLine( "The objects in the collection are: " );
for ( int i = 0; i < myObjectCollection1->Length; i++ )
{
Console::WriteLine( myObjectCollection1[ i ] );
}
Console::WriteLine( "" );
String^ myStringUrl1 = "http://localhost/dataservice.vsdisco";
if ( myDiscoveryClientReferenceCollection->Contains( myStringUrl1 ) )
{
Console::WriteLine( "The document reference {0} is part of the collection.", myStringUrl1 );
}
}
using System;
using System.Net;
using System.Collections;
using System.Security.Permissions;
using System.Web.Services.Discovery;
class MyDiscoveryClientReferenceCollection
{
static void Main()
{
Run();
}
[PermissionSetAttribute(SecurityAction.Demand, Name="FullTrust")]
static void Run()
{
DiscoveryClientProtocol myDiscoveryClientProtocol =
new DiscoveryClientProtocol();
myDiscoveryClientProtocol.Credentials =
CredentialCache.DefaultCredentials;
// 'dataservice.vsdisco' is a sample discovery document.
string myStringUrl = "http://localhost/dataservice.vsdisco";
// Call the Discover method to populate the References property.
DiscoveryDocument myDiscoveryDocument =
myDiscoveryClientProtocol.Discover(myStringUrl);
// Resolve all references found in the discovery document.
myDiscoveryClientProtocol.ResolveAll();
DiscoveryClientReferenceCollection myDiscoveryClientReferenceCollection =
myDiscoveryClientProtocol.References;
// Retrieve the keys from the collection.
ICollection myCollection = myDiscoveryClientReferenceCollection.Keys;
object[] myObjectCollection =
new object[myDiscoveryClientReferenceCollection.Count];
myCollection.CopyTo(myObjectCollection, 0);
Console.WriteLine("The discovery documents, service descriptions, " +
"and XML schema");
Console.WriteLine(" definitions in the collection are: ");
for (int i=0; i< myObjectCollection.Length; i++)
{
Console.WriteLine(myObjectCollection[i]);
}
Console.WriteLine("");
// Retrieve the values from the collection.
ICollection myCollection1 = myDiscoveryClientReferenceCollection.Values;
object[] myObjectCollection1 =
new object[myDiscoveryClientReferenceCollection.Count];
myCollection1.CopyTo(myObjectCollection1, 0);
Console.WriteLine("The objects in the collection are: ");
for (int i=0; i< myObjectCollection1.Length; i++)
{
Console.WriteLine(myObjectCollection1[i]);
}
Console.WriteLine("");
string myStringUrl1 = "http://localhost/dataservice.vsdisco";
if (myDiscoveryClientReferenceCollection.Contains(myStringUrl1))
{
Console.WriteLine("The document reference {0} is part of the collection.",
myStringUrl1);
}
}
}
Imports System.Net
Imports System.Collections
Imports System.Security.Permissions
Imports System.Web.Services.Discovery
Class MyDiscoveryClientReferenceCollection
Shared Sub Main()
Run()
End Sub
<PermissionSetAttribute(SecurityAction.Demand, Name := "FullTrust")> _
Shared Sub Run()
Dim myDiscoveryClientProtocol As New DiscoveryClientProtocol()
myDiscoveryClientProtocol.Credentials = CredentialCache.DefaultCredentials
' 'dataservice.vsdisco' is a sample discovery document.
Dim myStringUrl As String = "http://localhost/dataservice.vsdisco"
' Call the Discover method to populate the References property.
Dim myDiscoveryDocument As DiscoveryDocument = _
myDiscoveryClientProtocol.Discover(myStringUrl)
' Resolve all references found in the discovery document.
myDiscoveryClientProtocol.ResolveAll()
Dim myDiscoveryClientReferenceCollection As DiscoveryClientReferenceCollection = _
myDiscoveryClientProtocol.References
' Retrieve the keys from the collection.
Dim myCollection As ICollection = myDiscoveryClientReferenceCollection.Keys
Dim myObjectCollection(myDiscoveryClientReferenceCollection.Count) As Object
myCollection.CopyTo(myObjectCollection, 0)
Console.WriteLine("The discovery documents, service descriptions, and XML schema")
Console.WriteLine(" definitions in the collection are:")
Dim i As Integer
For i = 0 To myObjectCollection.Length - 1
Console.WriteLine(myObjectCollection(i))
Next i
' Retrieve the values from the collection.
Dim myCollection1 As ICollection = myDiscoveryClientReferenceCollection.Values
Dim myObjectCollection1(myDiscoveryClientReferenceCollection.Count - 1) As Object
myCollection1.CopyTo(myObjectCollection1, 0)
Console.WriteLine("The objects in the collection are:")
For i = 0 To myObjectCollection1.Length - 1
Console.WriteLine(myObjectCollection1(i))
Next i
Dim myStringUrl1 As String = "http://localhost/dataservice.vsdisco"
If myDiscoveryClientReferenceCollection.Contains(myStringUrl1) Then
Console.WriteLine("The document reference {0} is part of the collection.", _
myStringUrl1)
End If
End Sub
End Class
注解
属性References的类型DiscoveryClientProtocolDiscoveryClientReferenceCollection为 .
构造函数
DiscoveryClientReferenceCollection() |
初始化 DiscoveryClientReferenceCollection 类的新实例。 |
属性
Count |
获取 DictionaryBase 实例中包含的元素数。 (继承自 DictionaryBase) |
Dictionary |
获取 DictionaryBase 实例中包含的元素的列表。 (继承自 DictionaryBase) |
InnerHashtable |
获取 DictionaryBase 实例中包含的元素的列表。 (继承自 DictionaryBase) |
Item[String] |
在具有指定 URL 的 DiscoveryReference 中获取或设置一个 DiscoveryClientReferenceCollection 对象。 |
Keys |
获取一个 ICollection 对象,它具有 DiscoveryClientReferenceCollection 中的所有键。 |
Values |
获取一个 ICollection 对象,它具有 DiscoveryClientReferenceCollection 中的所有值。 |
方法
显式接口实现
ICollection.IsSynchronized |
获取一个值,该值指示对 DictionaryBase 对象的访问是否同步(线程安全)。 (继承自 DictionaryBase) |
ICollection.SyncRoot |
获取一个对象,该对象可用于同步对 DictionaryBase 对象的访问。 (继承自 DictionaryBase) |
IDictionary.Add(Object, Object) |
将带有指定键和值的元素添加到 DictionaryBase 中。 (继承自 DictionaryBase) |
IDictionary.Contains(Object) |
确定 DictionaryBase 是否包含特定键。 (继承自 DictionaryBase) |
IDictionary.IsFixedSize |
获取一个值,该值指示 DictionaryBase 对象是否具有固定大小。 (继承自 DictionaryBase) |
IDictionary.IsReadOnly |
获取一个值,该值指示 DictionaryBase 对象是否为只读。 (继承自 DictionaryBase) |
IDictionary.Item[Object] |
获取或设置与指定的键关联的值。 (继承自 DictionaryBase) |
IDictionary.Keys |
获取包含 ICollection 对象中的键的 DictionaryBase 对象。 (继承自 DictionaryBase) |
IDictionary.Remove(Object) |
从 DictionaryBase 中移除带有指定键的元素。 (继承自 DictionaryBase) |
IDictionary.Values |
获取 ICollection 对象,它包含 DictionaryBase 对象中的值。 (继承自 DictionaryBase) |
IEnumerable.GetEnumerator() |
返回循环访问 IEnumerator 的 DictionaryBase。 (继承自 DictionaryBase) |
扩展方法
Cast<TResult>(IEnumerable) |
将 IEnumerable 的元素强制转换为指定的类型。 |
OfType<TResult>(IEnumerable) |
根据指定类型筛选 IEnumerable 的元素。 |
AsParallel(IEnumerable) |
启用查询的并行化。 |
AsQueryable(IEnumerable) |
将 IEnumerable 转换为 IQueryable。 |