Search code examples
linqarcgis

Can I use LINQ when the data source can change?


I am creating an application extension for a software package call ESRI ArcGIS Desktop in .NET 4 and WPF. It will rely tabular data but I would like the storage options for this data be as flexible as possible. So the user can pull in things like Access mdbs, csv, xml, SQL Server, etc.

I would like to use LINQ but being new to it I am having trouble figuring out if it suitable. From what I read an EDMX is out which is fine but was not sure if LINQ will really work well without one. I was reading about the IQueryable which seems like it might work. But before I spend too long spinning my wheels I wanted to see if I am barking up the wrong tree.

Should I look further into something like IQueryable or am I making it overly complicated and can use something like IEnumrable, List, or Dictionaries, etc and LINQ should be fine with those? Or will this work at all?


Solution

  • You can use LINQ to Objects with any IEnumerable<T>. If you're working against ArcObjects, it's unlikely that any data source will be directly usable, however, as their "collections" aren't .NET collections.

    You can easily wrap them in your own IEnumerable<T> wrapper, and then use LINQ to Objects against them.