本文整理汇总了C#中Services.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# Services.AddRange方法的具体用法?C# Services.AddRange怎么用?C# Services.AddRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Services
的用法示例。
在下文中一共展示了Services.AddRange方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindServices
/// <summary>
/// Gets all the services for a list of devices.
/// </summary>
/// <param name="devices">The list of devices to find the services for.</param>
/// <param name="serviceType">The type of services to search for.</param>
/// <returns>The list of services found.</returns>
public static Services FindServices(this IUPnPDevices devices, string serviceType)
{
Services lsServices = new Services();
foreach (IUPnPDevice ldDevice in devices)
lsServices.AddRange(ldDevice.FindServices(Guid.Empty, serviceType));
return lsServices;
}
示例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;
}