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


C# StringSet.Remove方法代码示例

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


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

示例1: ShouldRemoveAndContainsReturnFalse

 public void ShouldRemoveAndContainsReturnFalse()
 {
     var stringSet = new StringSet();
     stringSet.Add("Test");
     Assert.IsTrue(stringSet.Contains("Test"));
     stringSet.Remove("Test");
     Assert.IsFalse(stringSet.Contains("Test"));
 }
开发者ID:david--liu,项目名称:code_kata,代码行数:8,代码来源:StringSetTest.cs

示例2: Add

        public void Add()
        {
            StringSet ss = new StringSet();
            ss.Add("foo");
            ss.Add("foo");
            ss.Add("bar");
            Assert.IsTrue(ss["foo"]);
            Assert.AreEqual(2, ss.Count);
            Assert.AreEqual("foo\r\nbar\r\n", ss.ToString());
            ss.Remove("bar");
            Assert.AreEqual(1, ss.Count);
            Assert.IsFalse(ss["fool"]);

            ss = new StringSet(new string[] { "foo", "bar"});
            ss.Add(new StringSet("baz"));
            Assert.AreEqual(3, ss.Count);
        }
开发者ID:krbysn,项目名称:jabber-net,代码行数:17,代码来源:StringSet.cs

示例3: Merge

        public void Merge()
        {
            StringSet ss = new StringSet();
            ss.Add("foo");
            StringSet so = new StringSet();
            so.Add("bar");
            so.Add("baz");
            ss.Add(so);
            Assert.AreEqual(3, ss.Count);

            so = new StringSet();
            so.Add("boo");
            so.Add("baz");
            ss.Add(so);
            Assert.AreEqual(4, ss.Count);

            ss.Remove(so);
            Assert.AreEqual(2, ss.Count);
            Assert.IsTrue(ss["foo"]);
            Assert.IsTrue(ss["bar"]);
            Assert.IsFalse(ss["boo"]);
            Assert.IsFalse(ss["baz"]);
            Assert.IsFalse(ss["bloo"]);
        }
开发者ID:krbysn,项目名称:jabber-net,代码行数:24,代码来源:StringSet.cs

示例4: FilterBracesInExpectedSet

 private StringSet FilterBracesInExpectedSet(StringSet stateExpectedSet) {
   var result = new StringSet();
   result.UnionWith(stateExpectedSet);
   //Find what brace we expect
   var nextClosingBrace = string.Empty;
   if (OpenBraces.Count > 0) {
     var lastOpenBraceTerm = OpenBraces.Peek().KeyTerm;
     var nextClosingBraceTerm = lastOpenBraceTerm.IsPairFor as KeyTerm;
     if (nextClosingBraceTerm != null) 
       nextClosingBrace = nextClosingBraceTerm.Text; 
   }
   //Now check all closing braces in result set, and leave only nextClosingBrace
   foreach(var closingBrace in Language.GrammarData.ClosingBraces) {
     if (result.Contains(closingBrace) && closingBrace != nextClosingBrace)
       result.Remove(closingBrace); 
     
   }
   return result; 
 }
开发者ID:o2platform,项目名称:O2.Platform.Projects,代码行数:19,代码来源:ParsingContext.cs

示例5: GetCurrentExpectedSymbols

 private StringList GetCurrentExpectedSymbols()
 {
     BnfTermList inputElements = new BnfTermList();
       StringSet inputKeys = new StringSet();
       inputKeys.AddRange(_currentState.Actions.Keys);
       //First check all NonTerminals
       foreach (NonTerminal nt in Data.NonTerminals) {
     if (!inputKeys.Contains(nt.Key)) continue;
     //nt is one of our available inputs; check if it has an alias. If not, don't add it to element list;
     // and we have already all its "Firsts" keys in the list.
     // If yes, add nt to element list and remove
     // all its "fists" symbols from the list. These removed symbols will be represented by single nt alias.
     if (string.IsNullOrEmpty(nt.DisplayName))
       inputKeys.Remove(nt.Key);
     else {
       inputElements.Add(nt);
       foreach(string first in nt.Firsts)
     inputKeys.Remove(first);
     }
       }
       //Now terminals
       foreach (Terminal term in Data.Terminals) {
     if (inputKeys.Contains(term.Key))
       inputElements.Add(term);
       }
       StringList result = new StringList();
       foreach(BnfTerm term in inputElements)
     result.Add(string.IsNullOrEmpty(term.DisplayName)? term.Name : term.DisplayName);
       result.Sort();
       return result;
 }
开发者ID:Temperament,项目名称:FiestaShark,代码行数:31,代码来源:Parser.cs


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