本文整理汇总了C#中ServiceType.HasFlag方法的典型用法代码示例。如果您正苦于以下问题:C# ServiceType.HasFlag方法的具体用法?C# ServiceType.HasFlag怎么用?C# ServiceType.HasFlag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServiceType
的用法示例。
在下文中一共展示了ServiceType.HasFlag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
/// <summary>
/// Initializes the service module.
/// </summary>
public static void Init(ServiceType services = ServiceType.All) {
if (services.HasFlag(ServiceType.All) || services.HasFlag(ServiceType.Category))
RouteTable.Routes.Add("REST_CATEGORY", new ServiceRoute("rest/category", new WebServiceHostFactory(), typeof(CategoryService)));
if (services.HasFlag(ServiceType.All) || services.HasFlag(ServiceType.Changes))
RouteTable.Routes.Add("REST_CHANGES", new ServiceRoute("rest/changes", new WebServiceHostFactory(), typeof(ChangeService)));
if (services.HasFlag(ServiceType.All) || services.HasFlag(ServiceType.Media))
RouteTable.Routes.Add("REST_CONTENT", new ServiceRoute("rest/content", new WebServiceHostFactory(), typeof(ContentService)));
if (services.HasFlag(ServiceType.All) || services.HasFlag(ServiceType.Page))
RouteTable.Routes.Add("REST_PAGE", new ServiceRoute("rest/page", new WebServiceHostFactory(), typeof(PageService)));
if (services.HasFlag(ServiceType.All) || services.HasFlag(ServiceType.PageType))
RouteTable.Routes.Add("REST_PAGETEMPLATE", new ServiceRoute("rest/pagetemplate", new WebServiceHostFactory(), typeof(PageTemplateService)));
if (services.HasFlag(ServiceType.All) || services.HasFlag(ServiceType.Post))
RouteTable.Routes.Add("REST_POST", new ServiceRoute("rest/post", new WebServiceHostFactory(), typeof(PostService)));
if (services.HasFlag(ServiceType.All) || services.HasFlag(ServiceType.PostType))
RouteTable.Routes.Add("REST_POSTTEMPLATE", new ServiceRoute("rest/posttemplate", new WebServiceHostFactory(), typeof(PostTemplateService)));
if (services.HasFlag(ServiceType.All) || services.HasFlag(ServiceType.SiteMap))
RouteTable.Routes.Add("REST_SITEMAP", new ServiceRoute("rest/sitemap", new WebServiceHostFactory(), typeof(SitemapServices)));
}
示例2: ServiceTypeToString
static String ServiceTypeToString(ServiceType serviceType)
{
var s = "";
if ( serviceType.HasFlag(ServiceType.ATM) )
s += "банкомат ";
if (serviceType.HasFlag(ServiceType.Cafe))
s += "кафе ";
if (serviceType.HasFlag(ServiceType.Shop))
s += "магазин ";
if (serviceType.HasFlag(ServiceType.Wash))
s += "мойка ";
if (serviceType.HasFlag(ServiceType.WC))
s += "туалет ";
return s;
}