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;
}
VulpesPosted Jan 1, 2014, 2:03 PM
Bryan KrossleyPosted Jan 1, 2014, 1:07 PM
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
VulpesPosted Jan 1, 2014, 12:02 PM