While playing around Stack collection in C# I encountered the following issue. Exactly I am not sure why it is happening. Please put some light on the reason and alternative
In Visual Studio 2019, this C# works:
List ls = null;
Stack ss = null;
if (json != null)
{
ls = JsonConvert.DeserializeObject>(json);
ss = new Stack(ls);
}
(This is an edit of the answer from here, which originally had an errant Reverse method call on the list that caused the opposite of the desired result.)