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


C# StringSegment.Equals方法代码示例

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


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

示例1: EqualMatchesEntireSubstring

 public void EqualMatchesEntireSubstring()
 {
     var segment = new StringSegment("abcdefghij", 2, 6);
     segment.Equals("cdefgh", StringComparison.Ordinal).ShouldBe(true);
     segment.Equals("cdefg", StringComparison.Ordinal).ShouldBe(false);
     segment.Equals("cdefghi", StringComparison.Ordinal).ShouldBe(false);
     segment.Equals("cDefgh", StringComparison.Ordinal).ShouldBe(false);
     segment.Equals("cDefgh", StringComparison.OrdinalIgnoreCase).ShouldBe(true);
 }
开发者ID:owin,项目名称:museum-piece-owin-hosting,代码行数:9,代码来源:StringSegmentTests.cs

示例2: HasPropertyRef

 /// <summary>
 /// Gets a value indicating whether the string has the specified property.
 /// </summary>
 /// <param name="prop">The name of the property to evaluate.</param>
 /// <returns><c>true</c> if the string has the specified property; otherwise, <c>false</c>.</returns>
 public Boolean HasPropertyRef(ref StringSegment prop)
 {
     foreach (var kvp in properties)
     {
         if (prop.Equals(kvp.Key))
         {
             return true;
         }
     }
     return false;
 }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:16,代码来源:LocalizedString.cs

示例3: MatchVariantInternal

        /// <summary>
        /// Matches a source string to a target variant according to the specified culture and rule.
        /// </summary>
        private static String MatchVariantInternal(String culture, LocalizedString source, LocalizedStringVariant target, StringSegment rule)
        {
            Dictionary<String, LocalizationMatchEvaluator> registry;
            if (!registeredMatchEvaluators.TryGetValue(culture, out registry))
                return null;

            foreach (var kvp in registry)
            {
                if (rule.Equals(kvp.Key))
                {
                    return (kvp.Value == null) ? null : kvp.Value(source, target);
                }
            }
            return null;
        }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:18,代码来源:Localization.cs

示例4: StringSegment_EqualsStringSegment_Invalid

        public void StringSegment_EqualsStringSegment_Invalid()
        {
            // Arrange
            var segment = new StringSegment();
            var candidate = new StringSegment("Hello, World!", 3, 2);

            // Act
            var result = segment.Equals(candidate, StringComparison.Ordinal);

            // Assert
            Assert.False(result);
        }
开发者ID:leloulight,项目名称:Common,代码行数:12,代码来源:StringSegmentTest.cs

示例5: StringSegment_Equals_String_Valid

        public void StringSegment_Equals_String_Valid(StringSegment candidate, StringComparison comparison, bool expectedResult)
        {
            // Arrange
            var segment = new StringSegment("Hello, World!", 1, 4);

            // Act
            var result = segment.Equals(candidate, comparison);

            // Assert
            Assert.Equal(expectedResult, result);
        }
开发者ID:leloulight,项目名称:Common,代码行数:11,代码来源:StringSegmentTest.cs

示例6: StringSegment_EqualsString_Invalid

        public void StringSegment_EqualsString_Invalid()
        {
            // Arrange
            var segment = new StringSegment();

            // Act
            var result = segment.Equals(string.Empty, StringComparison.Ordinal);

            // Assert
            Assert.False(result);
        }
开发者ID:leloulight,项目名称:Common,代码行数:11,代码来源:StringSegmentTest.cs

示例7: HasPropertyRef

 /// <summary>
 /// Gets a value indicating whether the string variant has the specified property.
 /// </summary>
 /// <param name="prop">The name of the property to evaluate.</param>
 /// <returns><see langword="true"/> if the string variant has the specified property; otherwise, <see langword="false"/>.</returns>
 public Boolean HasPropertyRef(ref StringSegment prop)
 {
     foreach (var property in properties)
     {
         if (prop.Equals(property))
             return true;
     }
     return parent.HasPropertyRef(ref prop);
 }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:14,代码来源:LocalizedStringVariant.cs

示例8: GetVariant

 /// <summary>
 /// Gets the specified string variant.
 /// </summary>
 /// <param name="group">The name of the variant group of the variant to retrieve.</param>
 /// <returns>The specified string variant.</returns>
 public LocalizedStringVariant GetVariant(ref StringSegment group)
 {
     foreach (var kvp in variants)
     {
         if (group.Equals(kvp.Key))
         {
             return kvp.Value;
         }
     }
     return null;
 }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:16,代码来源:LocalizedString.cs

示例9: EqualsString

 public void EqualsString(string content, string content2, bool expected)
 {
     var segment = new StringSegment(content);
     Assert.Equal(expected, segment.Equals(content2));
 }
开发者ID:DM-TOR,项目名称:nhin-d,代码行数:5,代码来源:StringSegmentFacts.cs

示例10: TestEquals

 public void TestEquals(string content)
 {
     var segment = new StringSegment(content);
     Assert.True(segment.Equals(segment));
 }
开发者ID:DM-TOR,项目名称:nhin-d,代码行数:5,代码来源:StringSegmentFacts.cs


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