I have been working on trying to leverage data contained in an Access Database for the last few weeks. I got to the point where I feel I should think how I will implement the design.
If I am not mistake one cannot use an Anonymous Type as a paramter to a method. This leaves me wondering what the best to return the result of a LINQ query within a method is. If you need some background information all the questions are from the last two weeks.
So this leaves me wondering someting:
Do I have to use the the var syntax when writting my query? Based on the article I read here Here I could in theory use my own class or in the examples listed on the page ( string, int, ect ).
This leads to me to the second part of my question:
If I were to say use the following syntax
IEnumerable<CustomClassHere> result = (from X in ....
where ....
**select** new CustomClassHere
{
Value = X.Field<int>("...")
}
);
Would I have able to return the result within a method that returns a IEnumerable?
I am willing to provide additional details, provide a more detailed code sample, if my current question is not clear. If you have any design suggestions that involve LINQ I would appreciate hearing them. I am looking to make this class and its interaction with the Access Database as modular as possible.
Sample Class
List Collection
ResultSet
Sample Reference
101 LINQ SAMPLES – Very helpful to make stronghold on LINQ to Objects