C# – Can we modify properties of object which is in Queue – C#

c++collectionspass-by-referencequeue

I have used System.Collections.Queue and its object form_elements_queue

if (form_elements_queue.Count > 0)
      queue_element = (RecordQueue)form_elements_queue.Peek();

I'm modifying the queue_element like below,

queue_element.Children--;

RecordQueue is my custom Type which I Enqueue in form_elements_queue.

but its not referencing the Original Queue.
How can I reference the queue_element to the original object which is in the queue.

Best Solution

Is RecordQueue a struct or a class? If it's a class, it should be fine.

How are you checking whether the original queue has been modified?