代码段:实现 ChangedIdEnumerator
上次修改时间: 2010年4月19日
适用范围: SharePoint Server 2010
本文内容
.NET 连接程序集的示例
ASP.NET Web 服务的示例
WCF 服务的示例
以下代码示例显示了如何在 .NET 连接程序集和 Web 服务中实现 ChangedIdEnumerator 方法实例。
.NET 连接程序集的示例
public CustomerVersion[] GetCustomerChangedIDs(String[] ids)
{
List<CustomerVersion> custverList = new List<CustomerVersion>();
foreach (Customer customer in customers)
{
if (Array.Find(ids, id =>
id == customer.CustomerID && !customer.IsDeleted) != null)
{
custverList.Add(new CustomerVersion()
{
CustomerID = customer.CustomerID,
Version = customer.Version
});
}
}
return custverList.ToArray();
}
ASP.NET Web 服务的示例
[WebMethod]
public CustomerVersion[] GetCustomerChangedIDs(String[] ids)
{
List<CustomerVersion> custverList = new List<CustomerVersion>();
foreach (Customer customer in customers)
{
if (Array.Find(ids, id =>
id == customer.CustomerID && !customer.IsDeleted) != null)
{
custverList.Add(new CustomerVersion()
{
CustomerID = customer.CustomerID,
Version = customer.Version
});
}
}
return custverList.ToArray();
}
WCF 服务的示例
以下代码演示服务合同接口中的操作定义。
[OperationContract]
CustomerVersion[] GetCustomerChangedIDs(string[] ids);
以下示例演示方法实例的实现。
public CustomerVersion[] GetCustomerChangedIDs(String[] ids)
{
List<CustomerVersion> custverList = new List<CustomerVersion>();
foreach (Customer customer in customers)
{
if (Array.Find(ids, id =>
id == customer.CustomerID && !customer.IsDeleted) != null)
{
custverList.Add(new CustomerVersion()
{
CustomerID = customer.CustomerID,
Version = customer.Version
});
}
}
return custverList.ToArray();
}