Bryan Krossley

Bryan Krossley

  • NA
  • 8
  • 3.8k

Reuse LINQ query

Jan 1 2014 10:43 AM

Hi!

I'm having trouble figuring out how to reuse my LINQ query in another class so I don't have to rewrite the query over and over again  Here is the query I am using below

On each class there is one slight change  I need to change the "in Client,GetPaperAsync(),Result"

The rest of the code would be the same


      public static void LoadGridView()

      {
          var client = new Service1Client();

            var query = (from c in client.GetBarberDimeAsync().Result
                         select new USPaperResults
                         {
                             CoinID = c.CoinID,
                             Checkbox = (bool)c.Checkbox,
                             Paper= c.Paper,
                            
                         }).ToList<USPaperResults>();

            Value = query;
        }


Answers (3)