0

I work on Windows Phone 8 app. Some methods of ObservableCollection and List are unavailable at several pages (not at all pages). Such methods as OrderBy and ElementAt. So, I can't sort my items in these collections because of it. How to find the reason of it? I have no idea.

splash27
  • 1,807
  • 4
  • 21
  • 45
  • Tools such as Resharper would suggest you are missing the using statement. This question shows some free alternatives to resharper you could try as well, http://stackoverflow.com/questions/2834439/what-are-some-alternatives-to-resharper. – Ash Burlaczenko Jun 11 '14 at 09:04

2 Answers2

5

Those aren't methods on ObservableCollection or List themselves. They're extension methods provided by the System.Linq.Enumerable class.

You probably just need an added using directive in your source code to make them available:

using System.Linq;

If that triggers another error saying that the namespace System.Linq isn't found, you'll need to add a reference to the System.Core assembly.

Jon Skeet
  • 1,261,211
  • 792
  • 8,724
  • 8,929
1

Because those are not List<T> methods, they're extension methods defined in the Enumerable class. To use them, add using System.Linq.

dcastro
  • 59,520
  • 20
  • 126
  • 147