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
Value = query;
}

VulpesRank #55 · 29.2K reputationPosted Jan 1, 2014, 7:02 AM EST
Bryan Krossley8 reputationPosted Jan 1, 2014, 8:07 AM EST
This is what I have come up with looking at your example
public static IEnumerable
{
return (from c in ie
select new USsingleResults
{
CoinID = c.CoinID,
Checkbox = (bool)c.Checkbox,
Year = c.Year,
Description = c.Description,
}).ToList
}
Service1Client is a local service.
In another class I add this to the constructor and I get this error
var client = new Service1Client();
Value = client.GetBarberDimeAsync().Result;
Cannot implicitly convert type 'System.Collections.ObjectModel.ObservableCollection
to
'System.Collections.ObjectModel.ObservableCollection
VulpesRank #55 · 29.2K reputationPosted Jan 1, 2014, 9:03 AM EST