本文整理汇总了C#中System.CodeDom.CodeCommentStatementCollection.IndexOf方法的典型用法代码示例。如果您正苦于以下问题:C# CodeCommentStatementCollection.IndexOf方法的具体用法?C# CodeCommentStatementCollection.IndexOf怎么用?C# CodeCommentStatementCollection.IndexOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.CodeDom.CodeCommentStatementCollection
的用法示例。
在下文中一共展示了CodeCommentStatementCollection.IndexOf方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Constructor1
public void Constructor1 ()
{
CodeCommentStatement ccs1 = new CodeCommentStatement ();
CodeCommentStatement ccs2 = new CodeCommentStatement ();
CodeCommentStatement[] statements = new CodeCommentStatement[] { ccs1, ccs2 };
CodeCommentStatementCollection coll = new CodeCommentStatementCollection (
statements);
Assert.AreEqual (2, coll.Count, "#1");
Assert.AreEqual (0, coll.IndexOf (ccs1), "#2");
Assert.AreEqual (1, coll.IndexOf (ccs2), "#3");
}
示例2: Constructor0_Deny_Unrestricted
public void Constructor0_Deny_Unrestricted ()
{
CodeCommentStatementCollection coll = new CodeCommentStatementCollection ();
Assert.AreEqual (0, coll.Add (ccs), "Add");
Assert.AreSame (ccs, coll[0], "this[int]");
coll.CopyTo (array, 0);
coll.AddRange (array);
coll.AddRange (coll);
Assert.IsTrue (coll.Contains (ccs), "Contains");
Assert.AreEqual (0, coll.IndexOf (ccs), "IndexOf");
coll.Insert (0, ccs);
coll.Remove (ccs);
}
示例3: Constructor2
public void Constructor2 ()
{
CodeCommentStatement ccs1 = new CodeCommentStatement ();
CodeCommentStatement ccs2 = new CodeCommentStatement ();
CodeCommentStatementCollection c = new CodeCommentStatementCollection ();
c.Add (ccs1);
c.Add (ccs2);
CodeCommentStatementCollection coll = new CodeCommentStatementCollection (c);
Assert.AreEqual (2, coll.Count, "#1");
Assert.AreEqual (0, coll.IndexOf (ccs1), "#2");
Assert.AreEqual (1, coll.IndexOf (ccs2), "#3");
}
示例4: Remove
public void Remove ()
{
CodeCommentStatement ccs1 = new CodeCommentStatement ();
CodeCommentStatement ccs2 = new CodeCommentStatement ();
CodeCommentStatementCollection coll = new CodeCommentStatementCollection ();
coll.Add (ccs1);
coll.Add (ccs2);
Assert.AreEqual (2, coll.Count, "#1");
Assert.AreEqual (0, coll.IndexOf (ccs1), "#2");
Assert.AreEqual (1, coll.IndexOf (ccs2), "#3");
coll.Remove (ccs1);
Assert.AreEqual (1, coll.Count, "#4");
Assert.AreEqual (-1, coll.IndexOf (ccs1), "#5");
Assert.AreEqual (0, coll.IndexOf (ccs2), "#6");
}
示例5: AddRange
public void AddRange ()
{
CodeCommentStatement ccs1 = new CodeCommentStatement ();
CodeCommentStatement ccs2 = new CodeCommentStatement ();
CodeCommentStatement ccs3 = new CodeCommentStatement ();
CodeCommentStatementCollection coll1 = new CodeCommentStatementCollection ();
coll1.Add (ccs1);
coll1.Add (ccs2);
CodeCommentStatementCollection coll2 = new CodeCommentStatementCollection ();
coll2.Add (ccs3);
coll2.AddRange (coll1);
Assert.AreEqual (3, coll2.Count, "#1");
Assert.AreEqual (1, coll2.IndexOf (ccs1), "#2");
Assert.AreEqual (2, coll2.IndexOf (ccs2), "#3");
Assert.AreEqual (0, coll2.IndexOf (ccs3), "#4");
CodeCommentStatementCollection coll3 = new CodeCommentStatementCollection ();
coll3.Add (ccs3);
coll3.AddRange (new CodeCommentStatement[] { ccs1, ccs2 });
Assert.AreEqual (3, coll2.Count, "#5");
Assert.AreEqual (1, coll2.IndexOf (ccs1), "#6");
Assert.AreEqual (2, coll2.IndexOf (ccs2), "#7");
Assert.AreEqual (0, coll2.IndexOf (ccs3), "#8");
}