>>>>Hi All
>>>>I have the class below that I want to use to data from my EF setup. I can't figure out what type to make the method so I can return the resulting LINQ object. The code below gives me this error.
>>>>
>>>>Cannot implicitly convert type 'System.Collections.Generic.IEnumerable AnonymousType#1 to 'System.Linq.Enumerable'
>>>>
>>>>Thanks.
>>>>
>>>>
>>>> public class MyBizClass
>>>> {
>>>> private CornMazeYellowPagesEntities oEFobject = null;
>>>> public MyBizClass()
>>>> {
>>>> this.oEFobject = new CornMazeYellowPagesEntities();
>>>> }
>>>>
>>>> public Enumerable getDirectory()
>>>> {
>>>> //CornMazeYellowPagesEntities queryobj = null;
>>>> var queryobj = from dr in this.oEFobject.DIRECTORies.AsEnumerable()
>>>> select new
>>>> {
>>>> dr.ADDRESS1,
>>>> dr.ADDRESS2,
>>>> dr.CITY,
>>>> dr.COMPANYNAME
>>>> };
>>>>
>>>> //queryobj =
>>>> // from dr in this.oEFobject.DIRECTORies
>>>> // select dr;
>>>>
>>>> return queryobj;
>>>> }
>>>> }
>>>>
>>>
>>>Either remove AsEnumerable() or change your return type to IEnumerable.
>>
>>Hi,
>>Does .AsEnumerable() in this context affect the type of queryobj ?
>>I thought it would need to be (from......).AsEnumerable() to make any difference......
>
>Viv,
>Yes it does and it is its purpose:) You can find information here:
>
>
http://cetinbasoz.spaces.live.com/blog/cns!D13F81744709AB9F!248.entry>
>The form you are showing is not really for AsEnumerable() usage but ToList(), ToArray(), ...
Thx - I'm clearer on that now. I also hadn't looked at the .OfType() operator until I read you link. Bet I'll have forgotten about it by the time I might have a use for it tho... :-{