Cloning queue in c# -


i have following code:

queue<string> oldqueue = new queue<string>();  oldqueue.enqueue("one"); oldqueue.enqueue("two"); oldqueue.enqueue("three");  queue newqueue = oldqueue; string newstring = newqueue.dequeue(); 

the problem once dequeue item newqueue, item dequeued oldqueue. there way "clone" queue in way removing item 1 queue keep it's clone queue unchanged?

queue reference type, newqueue , oldqueue holds pointer same object. same ;-)

see answer how "deep cloning" using reflection:

deep copy using reflection in extension method silverlight?


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -