WebReferenceCollection.Item プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > WebReferenceCollection.Item プロパティの意味・解説 

WebReferenceCollection.Item プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

指定したインデックス位置にある WebReference インスタンス取得または設定します

名前空間: System.Web.Services.Description
アセンブリ: System.Web.Services (system.web.services.dll 内)
構文構文

Dim instance As WebReferenceCollection
Dim index As Integer
Dim value As WebReference

value = instance(index)

instance(index) = value
public WebReference this [
    int index
] { get; set; }
public:
property WebReference^ default [int] {
    WebReference^ get (int index);
    void set (int index,
 WebReference^ value);
}
/** @property */
public WebReference get_Item (int index)

/** @property */
public void set_Item (int
 index, WebReference value)

パラメータ

index

Web 参照インデックス

プロパティ
指定したインデックス位置にある WebReference インスタンス

解説解説
使用例使用例

Item プロパティ使用方法コード例次に示します

using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Web.Services;
using System.Web.Services.Description;
using System.Web.Services.Discovery;
using System.Xml;
using System.Xml.Serialization;

public class Test
{
    public static void Main
 ()
    {
        // Read in a WSDL service description.
        string url = "http://www.contoso.com/Example/WebService.asmx?WSDL";
        XmlTextReader reader = new XmlTextReader(url);
        ServiceDescription wsdl = ServiceDescription.Read(reader);

        // Create a WSDL collection.
        DiscoveryClientDocumentCollection wsdlCollection = 
            new DiscoveryClientDocumentCollection();
        wsdlCollection.Add(url, wsdl);

        // Define the parameters needed to create web references.
        CodeNamespace proxyNamespace = new CodeNamespace("ExampleNamespace");
        string baseUrl = "http://www.contoso.com";
        string protocolName = "Soap12";

        // Create some web references.
        WebReference reference1 = new WebReference(
            wsdlCollection, proxyNamespace, protocolName, 
            "UrlKey1", baseUrl);
        WebReference reference2 = new WebReference(
            wsdlCollection, proxyNamespace, protocolName, 
            "UrlKey2", baseUrl);
        WebReference reference3 = new WebReference(
            wsdlCollection, proxyNamespace, protocolName, 
            "UrlKey3", baseUrl);

        // Create a web reference collection.
        WebReferenceCollection references = new WebReferenceCollection();
        references.Add(reference1);
        references.Add(reference2);

        // Confirm that the references were inserted.
        Console.WriteLine("The collection contains {0} references.", 
            references.Count);

        // Insert another reference into the collection.
        references.Insert(2, reference3);

        // Print the index of the inserted reference.
        int index = references.IndexOf(reference3);
        Console.WriteLine("The index of reference3 is {0}.", index);

        // Remove the inserted reference from the collection.
        references.Remove(reference3);

        // Determine if the collection contains reference3.
        if (references.Contains(reference3))
        {
            Console.WriteLine("The collection contains reference3.");
        }
        else 
        {
            Console.WriteLine("The collection does not contain reference3.");
        }

        // Print the URL key of the first reference in the collection.
        Console.WriteLine(
            "The URL key of the first reference in the collection
 is {0}.",
            references[0].AppSettingUrlKey);

        // Copy the collection to an array leaving the first array slot
 empty.
        WebReference[] referenceArray = new WebReference[3];
        references.CopyTo(referenceArray, 1);
        Console.WriteLine(
            "The URL key of the first reference in the array
 is {0}.",
            referenceArray[1].AppSettingUrlKey);
    }
}
import System.*;
import System.CodeDom.*;
import System.CodeDom.Compiler.*;
import System.Web.Services.*;
import System.Web.Services.Description.*;
import System.Web.Services.Discovery.*;
import System.Xml.*;
import System.Xml.Serialization.*;

public class Test
{
    public static void main(String[]
 args)
    {
        // Read in a WSDL service description.
        String url = "http://www.contoso.com/Example/WebService.asmx?WSDL";
        XmlTextReader reader = new XmlTextReader(url);
        ServiceDescription wsdl = ServiceDescription.Read(reader);

        // Create a WSDL collection.
        DiscoveryClientDocumentCollection wsdlCollection = 
            new DiscoveryClientDocumentCollection();
        wsdlCollection.Add(url, wsdl);

        // Define the parameters needed to create web references.
        CodeNamespace proxyNamespace = new CodeNamespace("ExampleNamespace");
        String baseUrl = "http://www.contoso.com";
        String protocolName = "Soap12";

        // Create some web references.
        WebReference reference1 = new WebReference(wsdlCollection,
 
            proxyNamespace, protocolName, "UrlKey1", baseUrl);
        WebReference reference2 = new WebReference(wsdlCollection,
 
            proxyNamespace, protocolName, "UrlKey2", baseUrl);
        WebReference reference3 = new WebReference(wsdlCollection,
 
            proxyNamespace, protocolName, "UrlKey3", baseUrl);

        // Create a web reference collection.
        WebReferenceCollection references = new WebReferenceCollection();
        references.Add(reference1);
        references.Add(reference2);

        // Confirm that the references were inserted.
        Console.WriteLine("The collection contains {0} references.", 
            (Int32)references.get_Count());

        // Insert another reference into the collection.
        references.Insert(2, reference3);

        // Print the index of the inserted reference.
        int index = references.IndexOf(reference3);
        Console.WriteLine("The index of reference3 is {0}.", (Int32)index);

        // Remove the inserted reference from the collection.
        references.Remove(reference3);

        // Determine if the collection contains reference3.
        if (references.Contains(reference3)) {
            Console.WriteLine("The collection contains reference3.");
        }
        else {
            Console.WriteLine("The collection does not contain reference3.");
        }
        // Print the URL key of the first reference in the collection.
        Console.WriteLine("The URL key of the first reference in
 "
            + "the collection is {0}.", 
            references.get_Item(0).get_AppSettingUrlKey());

        // Copy the collection to an array leaving the first array slot
 empty.
        WebReference referenceArray[] = new WebReference[3];
        references.CopyTo(referenceArray, 1);
        Console.WriteLine("The URL key of the first reference in
 the"
            + " array is {0}.", 
            referenceArray[1].get_AppSettingUrlKey());
    } //main
} //Test
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
WebReferenceCollection クラス
WebReferenceCollection メンバ
System.Web.Services.Description 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

WebReferenceCollection.Item プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



WebReferenceCollection.Item プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS