❔ Exists a node in priority queue or not (O(1)) with value type nodes

GGladiator12/20/2022
In reference types, it is OK.
There is an array of a struct type(Element) and I would like to swap some elements in it. Each element keeps its index as well.
Outside, an element of that array has been stored in a variable for example. Because it is value type, when swapping elements of the array and update index field, it does not reflect it, what is your idea?
public struct Element{
   //...
   public int Index;
}

var el = elements[10];

swap element(10) with element(5) and update index field inside.
Now, index in el is not updated because it is value type

My original situation is priority queue implemented for value types.
I keep index of nodes inside nodes. When the positions of those nodes change (heapify up/down), indices change.
Now, suppose I have kept a node of the priority queue in a variable. So, the index is wrong and obsolete
I want to know if a node exists in a priority queue or not (O(1)) but with value type nodes not ref types and then update the priority value for that node
CCyberrex12/21/2022
Because it is value type, when swapping elements of the array and update index field, it does not reflect it, what is your idea?
wdym by this
XWYBxianzai wo you bingqiling12/21/2022
what is your idea?
modify the Index before swapping the elements
AAccord12/22/2022
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.