本文整理汇总了C#中System.Collections.Stack.CopyTo方法的典型用法代码示例。如果您正苦于以下问题:C# Stack.CopyTo方法的具体用法?C# Stack.CopyTo怎么用?C# Stack.CopyTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Stack
的用法示例。
在下文中一共展示了Stack.CopyTo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestEmptyCopyTo
public void TestEmptyCopyTo ()
{
Stack stack = new Stack ();
string [] arr = new string [0];
stack.CopyTo (arr, 0);
}
示例2: CopyingOutOfRangeThrows_2
public static void CopyingOutOfRangeThrows_2()
{
Stack stack = new Stack();
stack.Push("MyString");
var objArr = new Object[0];
Assert.Throws<ArgumentException>(() => stack.CopyTo(objArr, 0));
}
示例3: CopyingOutOfRangeThrows_1
public static void CopyingOutOfRangeThrows_1()
{
Stack stack = new Stack();
var objArr = new Object[0];
Assert.Throws<ArgumentException>(() => stack.CopyTo(objArr, 1));
stack = new Stack();
Assert.Throws<ArgumentException>(() => stack.CopyTo(objArr, Int32.MaxValue));
stack = new Stack();
Assert.Throws<ArgumentOutOfRangeException>(() => stack.CopyTo(objArr, Int32.MinValue));
stack = new Stack();
Assert.Throws<ArgumentOutOfRangeException>(() => stack.CopyTo(objArr, -1));
}
示例4: CopyingToMultiDimArrayThrows
public static void CopyingToMultiDimArrayThrows()
{
Stack stack = new Stack();
stack.Push("hey");
Assert.Throws<ArgumentException>(() => stack.CopyTo(new Object[8, 8], 0));
}
示例5: CopyingToNullArrayThrows
public static void CopyingToNullArrayThrows()
{
Stack stack = new Stack();
stack.Push("hey");
Assert.Throws<ArgumentNullException>(() => stack.CopyTo(null, 0));
}
示例6: Run
public void Run(GISADataset CurrentDataSet, GISADataset.NivelRow CurrentNivel, INivelChainVisitor CurrentVisitor)
{
Queue PendingNivel = new Queue();
Stack ContextNivel = new Stack();
PendingNivel.Enqueue(CurrentNivel);
CurrentVisitor.InitVisit();
while (PendingNivel.Count > 0)
{
GISADataset.NivelRow CursorNivel = (GISADataset.NivelRow)(PendingNivel.Dequeue());
if (CursorNivel == null)
{
ContextNivel.Pop();
}
else
{
ContextNivel.Push(CursorNivel);
GISADataset.NivelRow[] ContextNivelEx = null;
ContextNivelEx = new GISADataset.NivelRow[ContextNivel.Count];
ContextNivel.CopyTo(ContextNivelEx, 0);
CurrentVisitor.Visit(CurrentDataSet, ContextNivelEx);
foreach (GISADataset.RelacaoHierarquicaRow rhRow in GetNextNivelRows(CurrentDataSet, CursorNivel))
{
PendingNivel.Enqueue(rhRow.NivelRowByNivelRelacaoHierarquica);
}
PendingNivel.Enqueue(null);
}
}
CurrentVisitor.DoneVisit();
}