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


C# String.Is方法代码示例

本文整理汇总了C#中System.String.Is方法的典型用法代码示例。如果您正苦于以下问题:C# String.Is方法的具体用法?C# String.Is怎么用?C# String.Is使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.String的用法示例。


在下文中一共展示了String.Is方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateValue

        static JsonValue CreateValue(String type, String value)
        {
            if (type.Is(InputTypeNames.Checkbox))
                return new JsonValue(value.Is(Keywords.On));
            else if (type.Is(InputTypeNames.Number))
                return new JsonValue(value.ToDouble());

            return new JsonValue(value);
        }
开发者ID:howej,项目名称:AngleSharp,代码行数:9,代码来源:JsonFormDataSetVisitor.cs

示例2: RemoveNamedItemOrDefault

        internal IAttr RemoveNamedItemOrDefault(String name, Boolean suppressMutationObservers)
        {
            for (var i = 0; i < _items.Count; i++)
            {
                if (name.Is(_items[i].Name))
                {
                    var attr = _items[i];
                    _items.RemoveAt(i);
                    attr.Container = null;

                    if (!suppressMutationObservers)
                    {
                        RaiseChangedEvent(attr, null, attr.Value);
                    }

                    return attr;
                }
            }

            return null;
        }
开发者ID:Wojdav,项目名称:AngleSharp,代码行数:21,代码来源:NamedNodeMap.cs

示例3: SupportsProtocol

 /// <summary>Checks if the data protocol is given.</summary>
 /// <param name="protocol">The protocol to check for data.</param>
 /// <returns>True if data is matched, otherwise false..</returns>
 public Boolean SupportsProtocol(String protocol)
 {
     return protocol.Is(KnownProtocols.Data);
 }
开发者ID:JBTech,项目名称:AngleSharp,代码行数:7,代码来源:DataRequester.cs

示例4: GetNamedItem

        public IAttr GetNamedItem(String namespaceUri, String localName)
        {
            for (var i = 0; i < _items.Count; i++)
            {
                if (localName.Is(_items[i].LocalName) && namespaceUri.Is(_items[i].NamespaceUri))
                {
                    return _items[i];
                }
            }

            return null;
        }
开发者ID:Wojdav,项目名称:AngleSharp,代码行数:12,代码来源:NamedNodeMap.cs

示例5: SubmitForm

        private DocumentRequest SubmitForm(HttpMethod method, String scheme, Url action, IHtmlElement submitter)
        {
            if (scheme.IsOneOf(ProtocolNames.Http, ProtocolNames.Https))
            {
                if (method == HttpMethod.Get)
                {
                    return MutateActionUrl(action, submitter);
                }
                else if (method == HttpMethod.Post)
                {
                    return SubmitAsEntityBody(action, submitter);
                }
            }
            else if (scheme.Is(ProtocolNames.Data))
            {
                if (method == HttpMethod.Get)
                {
                    return GetActionUrl(action);
                }
                else if (method == HttpMethod.Post)
                {
                    return PostToData(action, submitter);
                }
            }
            else if (scheme.Is(ProtocolNames.Mailto))
            {
                if (method == HttpMethod.Get)
                {
                    return MailWithHeaders(action, submitter);
                }
                else if (method == HttpMethod.Post)
                {
                    return MailAsBody(action, submitter);
                }
            }
            else if (scheme.IsOneOf(ProtocolNames.Ftp, ProtocolNames.JavaScript))
            {
                return GetActionUrl(action);
            }

            return MutateActionUrl(action, submitter);
        }
开发者ID:Wojdav,项目名称:AngleSharp,代码行数:42,代码来源:HtmlFormElement.cs

示例6: AddHeader

 /// <summary>
 /// Dirty dirty workaround since the webrequester itself is already
 /// quite stupid, but the one here (for the PCL) is really not the
 /// way things should be programmed ...
 /// </summary>
 /// <param name="key">The key to add or change.</param>
 /// <param name="value">The value to be set.</param>
 private void AddHeader(String key, String value)
 {
     if (key.Is(HeaderNames.Accept))
     {
         _http.Accept = value;
     }
     else if (key.Is(HeaderNames.ContentType))
     {
         _http.ContentType = value;
     }
     else if (key.Is(HeaderNames.Expect))
     {
         SetProperty(HeaderNames.Expect, value);
     }
     else if (key.Is(HeaderNames.Date))
     {
         SetProperty(HeaderNames.Date, DateTime.Parse(value));
     }
     else if (key.Is(HeaderNames.Host))
     {
         SetProperty(HeaderNames.Host, value);
     }
     else if (key.Is(HeaderNames.IfModifiedSince))
     {
         SetProperty("IfModifiedSince", DateTime.Parse(value));
     }
     else if (key.Is(HeaderNames.Referer))
     {
         SetProperty(HeaderNames.Referer, value);
     }
     else if (key.Is(HeaderNames.UserAgent))
     {
         SetProperty("UserAgent", value);
     }
     else if (!key.Is(HeaderNames.Connection) && !key.Is(HeaderNames.Range) && !key.Is(HeaderNames.ContentLength) && !key.Is(HeaderNames.TransferEncoding))
     {
         _http.Headers[key] = value;
     }
 }
开发者ID:Wojdav,项目名称:AngleSharp,代码行数:46,代码来源:HttpRequester.cs

示例7: HtmlQuoteElement

 public HtmlQuoteElement(Document owner, String name = null, String prefix = null)
     : base(owner, name ?? TagNames.Quote, prefix, name.Is(TagNames.BlockQuote) ? NodeFlags.Special : NodeFlags.None)
 {
 }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:4,代码来源:HtmlQuoteElement.cs

示例8: RemoveNamedItemOrDefault

        internal IAttr RemoveNamedItemOrDefault(String namespaceUri, String localName)
        {
            for (int i = 0; i < _items.Count; i++)
            {
                if (localName.Is(_items[i].LocalName) && namespaceUri.Is(_items[i].NamespaceUri))
                {
                    var attr = _items[i];
                    _items.RemoveAt(i);
                    attr.Container = null;
                    RaiseChangedEvent(attr, null, attr.Value);
                    return attr;
                }
            }

            return null;
        }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:16,代码来源:NamedNodeMap.cs

示例9: IsInvalid

 Boolean IsInvalid(RenderDevice device, String keyword, RenderDevice.Kind kind)
 {
     return keyword.Is(Type) && (device.DeviceType == kind) == IsInverse;
 }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:4,代码来源:CssMedium.cs

示例10: ExtractFor

            public CssValue ExtractFor(String name)
            {
                if (name.Is(_labels[0]))
                {
                    return _top.Original;
                }
                else if (name.Is(_labels[1]))
                {
                    return _right.Original;
                }
                else if (name.Is(_labels[2]))
                {
                    return _bottom.Original;
                }
                else if (name.Is(_labels[3]))
                {
                    return _left.Original;
                }

                return null;
            }
开发者ID:Wojdav,项目名称:AngleSharp,代码行数:21,代码来源:PeriodicValueConverter.cs

示例11: Bundle

 static String Bundle(String prefix, String match)
 {
     return prefix.Is("*") ? match : String.Concat(prefix, ":", match);
 }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:4,代码来源:SimpleSelector.cs

示例12: CreateElement

        /// <summary>
        /// Creates a new element with the given tag name and namespace URI.
        /// </summary>
        /// <param name="namespaceUri">
        /// Specifies the namespace URI to associate with the element.
        /// </param>
        /// <param name="qualifiedName">
        /// A string that specifies the type of element to be created.
        /// </param>
        /// <returns>The created element.</returns>
        public IElement CreateElement(String namespaceUri, String qualifiedName)
        {
            var localName = default(String);
            var prefix = default(String);
            GetPrefixAndLocalName(qualifiedName, ref namespaceUri, out prefix, out localName);

            if (namespaceUri.Is(NamespaceNames.HtmlUri))
            {
                var element = Factory.HtmlElements.Create(this, localName, prefix);
                element.SetupElement();
                return element;
            }
            else if (namespaceUri.Is(NamespaceNames.SvgUri))
            {
                var element = Factory.SvgElements.Create(this, localName, prefix);
                element.SetupElement();
                return element;
            }
            else if (namespaceUri.Is(NamespaceNames.MathMlUri))
            {
                var element = Factory.MathElements.Create(this, localName, prefix);
                element.SetupElement();
                return element;
            }
            else
            {
                var element = new Element(this, localName, prefix, namespaceUri);
                element.SetupElement();
                return element;
            }
        }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:41,代码来源:Document.cs

示例13: MatchesCssNamespace

        /// <summary>
        /// Checks if the element with the provided prefix matches the CSS
        /// namespace.
        /// </summary>
        /// <param name="el">The element to examine.</param>
        /// <param name="prefix">The namespace in question.</param>
        /// <returns>True if the namespace is matched, else false.</returns>
        public static Boolean MatchesCssNamespace(this IElement el, String prefix)
        {
            if (prefix.Is(Keywords.Asterisk))
            {
                return true;
            }

            var nsUri = el.GetAttribute(NamespaceNames.XmlNsPrefix) ?? el.NamespaceUri;

            if (prefix.Is(String.Empty))
            {
                return nsUri.Is(String.Empty);
            }

            return nsUri.Is(GetCssNamespace(el, prefix));
        }
开发者ID:Wojdav,项目名称:AngleSharp,代码行数:23,代码来源:ElementExtensions.cs

示例14: IsXmlNamespaceAttribute

 static Boolean IsXmlNamespaceAttribute(String name)
 {
     return name.Length > 4 && (name.Is(NamespaceNames.XmlNsPrefix) || name.Is("xmlns:xlink"));
 }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:4,代码来源:HtmlForeignExtensions.cs

示例15: SupportsProtocol

 /// <summary>Checks if the data protocol is given.</summary>
 /// <param name="protocol">The protocol to check for data.</param>
 /// <returns>True if data is matched, otherwise false..</returns>
 public Boolean SupportsProtocol(String protocol)
 {
     return protocol.Is(ProtocolNames.Data);
 }
开发者ID:Wojdav,项目名称:AngleSharp,代码行数:7,代码来源:DataRequester.cs


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