How can I enqueue value of a queue (not it reference) to another queue? It work like I have a queue of points in C++ (Queue<*word>), but I want to copy value of buffer queue like this
a = 1;
int[] array = new int[1]
array[0] = a //array[0] now is 1
a = 0 // but array[0] doesn't change, array[0] is 1!
I have problem in words.Enqueue(buffer)
using word = System.Collections.Generic.Queue<char>;
Queue<word> words = new Queue<word>(); //word is the custom type, that was def in file top
word buffer = new word();
for (var symbol_count = 0; symbol_count < text.Length; ++symbol_count)
{
if (text[symbol_count] != ' ' && text[symbol_count] != '.' && text[symbol_count] != ',')
{
buffer.Enqueue(text[symbol_count]); //store one char in word
}
else
{
buffer.Enqueue(text[symbol_count]); //store end of word symbol
words.Enqueue(buffer); //store one word in words queue, but compiler do it like I try to copy a reference of buffer, not it value!!!
//System.Console.WriteLine(words.Count); DEBUG
buffer.Clear(); //clear buffer and when i do this, value in words queue is deleted too!!!
}
}