I am trying to make use of the code in this question to implement a query like this:
    public void LoadLive(DbConnection pConnection)
    {
        using (DbDataReader lReader = pConnection.ExecuteReader("..."))
        {
            mList.AddRange(from t in lReader select new MyObject { Name = t.GetString(0) });
        }
    }
When I attempt to compile this (with the extension method in place), I receive this error:
 error CS1934: Could not find an implementation of the query pattern for source type 'System.Data.Common.DbDataReader'.  'Select' not found.  Consider explicitly specifying the type of the ra开发者_Python百科nge variable 't'.
Am I missing something about how this is supposed to work?
You must call the extension method from the answer in the linked question:
 mList.AddRange(from t in lReader.AsEnumerable() 
                select new MyObject { Name = t.GetString(0) });
Unless you are going to write your own extension method, Select, Where, etc all return an IEnumerable and the typical method signature will resemble Func<DbDataReader, myT>. What you are looking for is something like Jon Skeet's sample here.
Compiler error CS1934 is produced when no standard query operators are implemented for a given datasource.
In your case (DbDataReader), you could specify the type of t as IDataRecord:
mList.AddRange(from IDataRecord t in lReader
               select new MyObject { Name = t.GetString(0) });
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论