상속 관계...
[SerializableAttribute] [ComVisibleAttribute(true)] public class Queue : ICollection, IEnumerable, ICloneable
받는 쪽 구현
using System; using System.Collections; public class SamplesQueue { public static void Main() { // Creates and initializes a new Queue. Queue myQ = new Queue(); myQ.Enqueue("Hello"); myQ.Enqueue("World"); myQ.Enqueue("!"); // Displays the properties and values of the Queue. Console.WriteLine( "myQ" ); Console.WriteLine( "\tCount: {0}", myQ.Count ); Console.Write( "\tValues:" ); PrintValues( myQ ); } public static void PrintValues( IEnumerable myCollection ) { foreach ( Object obj in myCollection ) Console.Write( " {0}", obj ); Console.WriteLine(); } } /* This code produces the following output. myQ Count: 3 Values: Hello World ! */
테스트 코드
namespace Queue_Test
{
public class Queue_Control_Class
{
protected void QueueControl(ref IEnumerable tempQueue)
{
Queue testQueue = (Queue)tempQueue;if (testQueue.Count != 0)
{
testQueue.Dequeue();
}
}
}public class Queue_Save_Class : Queue_Control_Class
{
public Queue _SaveQueue = new Queue();public void QueueDeQueue()
{
IEnumerable tempQueue = _SaveQueue;QueueControl(ref tempQueue);
}
}class Program
{
static void Main(string[] args)
{
Queue_Save_Class test = new Queue_Save_Class();
for(int i=0; i<5; i++)
test._SaveQueue.Enqueue(i);
foreach (int temp in test._SaveQueue)
{
Console.Write("{0} ", temp);
}
Console.WriteLine("");
test.QueueDeQueue();
foreach (int temp in test._SaveQueue)
{
Console.Write("{0} ", temp);
}
Console.ReadKey();
}
}
}