I have a LINQ query that returns some object like this...
var query = from c in db.Customers
            where ...
            select c;
Then I do this
    List<String> list = new List<String>();
    foreach (ProgramLanguage c in query)
    {
        //GetUL returns a String
        list.Add(GetUL(c.Property,c.Property2));
    }
Is...
            
           
          
            
            Hi,
I need to convert an IQueryable to List(is it possible to convert to IList?). There had not been an problem if it was not that i need to Cast<T> because I have interfaces to my objects.
I've tried most things but for some reason I must run Cast<T> first and then ToList() which generates System.NullReferenceException. How do I solve ...
            
           
          
            
            I was looking at some examples in microsoft site about linq and I see an example that I need to modify!
http://msdn.microsoft.com/en-us/vcsharp/aa336758.aspx#SelectManyCompoundfrom3
public void Linq16()
{
    List customers = GetCustomerList();
var orders =
    from c in customers
    from o in c.Orders
    where o.OrderDate >= new Da...
            
           
          
            
            Hi, can anyone tell me why this doesnt work?
 public class GeocodeCoord
 {
     public string Outcode { get; set; }
     public int X { get; set; }
     public int Y { get; set; }
 }
List<GeocodeCoord> _geocode;
using (MyDataContext db = new MyDataContext())
{
   _geocode = db.Geocodes.Select(g => new GeocodeCoord { g.postcode, g.x...
            
           
          
            
            I'm looking for rules of thumb for calling ToList/ToArray/MemoizeAll(Rx) on IEnumerables, as opposed to returning the query itself when returning IEnumerable of something. 
Often I find that it is better to just return the query and let the caller decide whether a list is needed or not, but sometimes it can come back and bite you in the...
            
           
          
            
            Consider following LINQ-to-NHibernate queries:
var q1 = from se in query.ToList<SomeEntity>()
  where
  prop1 == "abc"
  select se;
var q2 = from se in q1
  where 
  m1(se.prop2) == "def"
  select  se;
q2 will not work with error: "The method m1 is not implemented". But when replace q2 with following query, everything goes ok:
var q...
            
           
          
            
            I have the following C# code and I have no idea why it's not working (I'm getting a NullReferenceException error). If I define Recipe as new List() everything starts working OK.
foreach (XElement element in document.Descendants("vegetables"))
        {
            VegetablesList = (
                from vegetables in element.Elements()
...