I am making application using c#. I have one queue as follows...
Queue QueueData = new Queue(60);
I want to find the min and max element from that queue. Any ideas?
You could use linq Min
and Max
methods.
Convert your Queue
to Queue<T>
and look here for examples: http://code.msdn.microsoft.com/LINQ-Aggregate-Operators-c51b3869
Of course, you must specify what value you want the max and min values of:
var max = QueueData.Max(x => x.SomeSelectedComparableValue);
var min = QueueData.Min(x => x.SomeSelectedComparableValue);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.