When to use the Stack collection in C#?

后端 未结 12 2267
滥情空心
滥情空心 2021-02-14 20:44

I do understand how Stack() and Stack works, but I really can\'t see any scenarios where an array, List or IEnumer

12条回答
  •  无人共我
    2021-02-14 20:53

    You can rewrite recursive methods as iterative counterparts much easier by controlling the locals on and off the stack. Check out Jon Skeet's sort using the stack here.

提交回复
热议问题