本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
}
示例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)
{
}
示例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;
}
示例9: IsInvalid
Boolean IsInvalid(RenderDevice device, String keyword, RenderDevice.Kind kind)
{
return keyword.Is(Type) && (device.DeviceType == kind) == IsInverse;
}
示例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;
}
示例11: Bundle
static String Bundle(String prefix, String match)
{
return prefix.Is("*") ? match : String.Concat(prefix, ":", match);
}
示例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;
}
}
示例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));
}
示例14: IsXmlNamespaceAttribute
static Boolean IsXmlNamespaceAttribute(String name)
{
return name.Length > 4 && (name.Is(NamespaceNames.XmlNsPrefix) || name.Is("xmlns:xlink"));
}
示例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);
}