当前位置: 首页>>代码示例>>C#>>正文


C# Services.Add方法代码示例

本文整理汇总了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 });
        }
开发者ID:jbrwn,项目名称:tc,代码行数:11,代码来源:TMSController.cs

示例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;
        }
开发者ID:hoeness2,项目名称:mcebuddy2,代码行数:20,代码来源:IUPnPDeviceExtensions.cs


注:本文中的Services.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。