次の方法で共有


コード スニペット: IdEnumerator の実装

最終更新日: 2010年4月19日

適用対象: SharePoint Server 2010

この記事の内容
.NET Connectivity Assembly での例
ASP.NET Web サービスでの例
WCF サービスでの例

以下のコード例では, .NET Connectivity Assembly と Web サービスに、IdEnumerator メソッド インスタンスを実装する方法を示します。

.NET Connectivity Assembly での例

public String[] GetCustomerIDs()
{
    string[] customerIDs = new string[customers.Count];

    for (int i = 0; i < customers.Count; i++)
    {
        if (!customers[i].IsDeleted)
            customerIDs[i] = customers[i].CustomerID;
    }
    return customerIDs;
}

ASP.NET Web サービスでの例

[WebMethod]
public String[] GetCustomerIDs()
{
    string[] customerIDs = new string[customers.Count];

    for (int i = 0; i < customers.Count; i++)
    {
        if (!customers[i].IsDeleted)
            customerIDs[i] = customers[i].CustomerID;
    }
    return customerIDs;
}

WCF サービスでの例

以下のコードは、サービス コントラクト インターフェイスでの操作定義を示します。

[OperationContract]
string[] GetCustomerIDs();

以下の例は、メソッド インスタンスの実装を示します。

public String[] GetCustomerIDs()
{
    string[] customerIDs = new string[customers.Count];

    for (int i = 0; i < customers.Count; i++)
    {
        if (!customers[i].IsDeleted)
            customerIDs[i] = customers[i].CustomerID;
    }
    return customerIDs;
}

関連項目

概念

IdEnumerator の実装