當前位置: 首頁>>代碼示例>>C#>>正文


C# AList.Contains方法代碼示例

本文整理匯總了C#中AList.Contains方法的典型用法代碼示例。如果您正苦於以下問題:C# AList.Contains方法的具體用法?C# AList.Contains怎麽用?C# AList.Contains使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在AList的用法示例。


在下文中一共展示了AList.Contains方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: LogAllCommits

		public virtual void LogAllCommits()
		{
			IList<RevCommit> commits = new AList<RevCommit>();
			Git git = Git.Wrap(db);
			WriteTrashFile("Test.txt", "Hello world");
			git.Add().AddFilepattern("Test.txt").Call();
			commits.AddItem(git.Commit().SetMessage("initial commit").Call());
			git.BranchCreate().SetName("branch1").Call();
			Ref checkedOut = git.Checkout().SetName("branch1").Call();
			NUnit.Framework.Assert.AreEqual("refs/heads/branch1", checkedOut.GetName());
			WriteTrashFile("Test1.txt", "Hello world!");
			git.Add().AddFilepattern("Test1.txt").Call();
			commits.AddItem(git.Commit().SetMessage("branch1 commit").Call());
			checkedOut = git.Checkout().SetName("master").Call();
			NUnit.Framework.Assert.AreEqual("refs/heads/master", checkedOut.GetName());
			WriteTrashFile("Test2.txt", "Hello world!!");
			git.Add().AddFilepattern("Test2.txt").Call();
			commits.AddItem(git.Commit().SetMessage("branch1 commit").Call());
			Iterator<RevCommit> log = git.Log().All().Call().Iterator();
			NUnit.Framework.Assert.IsTrue(log.HasNext());
			NUnit.Framework.Assert.IsTrue(commits.Contains(log.Next()));
			NUnit.Framework.Assert.IsTrue(log.HasNext());
			NUnit.Framework.Assert.IsTrue(commits.Contains(log.Next()));
			NUnit.Framework.Assert.IsTrue(log.HasNext());
			NUnit.Framework.Assert.IsTrue(commits.Contains(log.Next()));
			NUnit.Framework.Assert.IsFalse(log.HasNext());
		}
開發者ID:LunarLanding,項目名稱:ngit,代碼行數:27,代碼來源:LogCommandTest.cs

示例2: GetPv

 /// <summary>
 /// Gets the principal variation and the best move from the transposition
 /// table
 /// </summary>
 private void GetPv()
 {
     StringBuilder sb = new StringBuilder();
     IList<long> keys = new AList<long>();
     // To not repeat keys
     int i = 0;
     while (i < 256)
     {
         if (tt.Search(board, false))
         {
             if (keys.Contains(board.GetKey()))
             {
                 break;
             }
             keys.AddItem(board.GetKey());
             if (tt.GetBestMove() == 0)
             {
                 break;
             }
             if (i == 0)
             {
                 globalBestMove = tt.GetBestMove();
             }
             else
             {
                 if (i == 1)
                 {
                     ponderMove = tt.GetBestMove();
                 }
             }
             sb.Append(Move.ToString(tt.GetBestMove()));
             sb.Append(" ");
             i++;
             board.DoMove(tt.GetBestMove(), false);
         }
         else
         {
             break;
         }
     }
     // Now undo moves
     for (int j = 0; j < i; j++)
     {
         board.UndoMove();
     }
     pv = sb.ToString();
 }
開發者ID:rayokota,項目名稱:carballo,代碼行數:51,代碼來源:SearchEngine.cs


注:本文中的AList.Contains方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。