本文整理汇总了C#中Services.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Services.Add方法的具体用法?C# Services.Add怎么用?C# Services.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Services
的用法示例。
在下文中一共展示了Services.Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Root
public HttpResponseMessage Root()
{
Services services = new Services();
TileMapServiceMetadata metadata = new TileMapServiceMetadata();
metadata.title = "Tile Map Service";
metadata.version = "1.0.0";
metadata.href = Url.Link("TMSService", new { Version = "1.0.0" });
services.Add(metadata);
return Request.CreateResponse(HttpStatusCode.OK, services, new XmlMediaTypeFormatter() { UseXmlSerializer = true });
}
示例2: FindServices
/// <summary>
/// Finds services for a device.
/// </summary>
/// <param name="device">The device to get the services for.</param>
/// <param name="interfaceGuid">The network guid for any new devices if available.</param>
/// <param name="serviceType">The service type for the services to search for.</param>
/// <returns>The services found.</returns>
public static Services FindServices(this IUPnPDevice device, Guid interfaceGuid, string serviceType)
{
Services lsServices = new Services();
foreach (IUPnPService lsService in device.Services)
if (lsService.ServiceTypeIdentifier == serviceType)
lsServices.Add(new Service(device, interfaceGuid, lsService));
foreach (IUPnPDevice ldDevice in device.Children)
lsServices.AddRange(ldDevice.FindServices(interfaceGuid, serviceType));
return lsServices;
}