> Dim orders As IEnumerable(Of DataRow) = osql.dt.AsEnumerable > Dim Test2 = From r In orders _ > Group r By nummer = r.Field(Of String)("KL_Nummer"), name = r.Field(Of String)("KL_Naam"), artBtw = r.Field(Of Double)("ArtBtw") _ > Into g = Group Select New With {.Nummer = nummer, .Name = name, .artbtw = artBtw, .total = g.Sum(Function(r) _ > r.Field(Of Decimal)("Bestd_Waarde") * (1.0 - CDbl(If(r("art_korting") = False, 0.0, If(r("kkkorting") Is DBNull.Value, CDbl(r("KLkorting")), CDbl(r("KKKorting")))))))} > Dim test = From r In Test2 Order By r.Name >Why bother. You are only building a query which will not be executed until the IEnumerable is evaluated. For example try this:
IEnumerable<string> list = new List<string>() { "One", "Two", "Three" }; var test2 = (from s in list select s); foreach (string s in test2) Console.WriteLine(s); Console.WriteLine("-----------------"); ((List<string>)list).Add("Four"); var test = from s in test2 orderby s ascending select s; foreach (string s in test) Console.WriteLine(s); Console.ReadLine();UPDATE. Guess I assumed you were making the switch to C# :-}
Dim list As IEnumerable(Of String) = New List(Of String)() With { _ "One", _ "Two", _ "Three" _ } Dim test2 = () For Each s As String In test2 Console.WriteLine(s) Next Console.WriteLine("-----------------") DirectCast(list, List(Of String)).Add("Four") Dim test = _ Order By s Ascending For Each s As String In test Console.WriteLine(s) Next Console.ReadLine()