Silly if you ask me. But this message is here because I will assume (probably correctly) that I am the silly one, not Microsoft. So... is there something I'm missing? Why didn't they include a "Find" method to this baby? The find could work on the Values, which are objects, so then I could do this:
someObject = SortedList.Values.Find(order => order.OrderID == orderID);
You might be looking for .First(...) or .Single(...) (or their OrDefault variants) in LINQ, but that only really works well with types that implement IEnumerable<T>. A SortedList is not strongly typed, hence the Lambda won't work. Have a look at LINQ's .Cast<T>().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With