當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。