Prev: database application
Next: Question on MDIchild forms
From: Tom Shelton on 7 Jan 2010 09:11 On 2010-01-07, Armin Zingler <az.nospam(a)freenet.de> wrote: > Mr. Arnold schrieb: >> You should pull the data 'q' with no order by >> >> This is C# example as close as I can get it. I don't have code in front >> of me. >> >> var a = q.orderacending(b => b.Property).Tolist(); >> >> >> I don't know if you have Lambda statement in VB. > > I'm afraid, I can't read and translate this sCrabble# code. Thx anyway. > > I think the Mr. Arnold was implying something like this: Option Explicit On Option Strict On Option Infer On Module Module1 Dim rnd As New Random Sub Main() Dim lst As New List(Of TestClass) For i As Integer = 1 To 100 lst.Add(New TestClass(rnd.Next(1, 101), Chr(rnd.Next(65, 91)))) Next Dim orderByInt As Func(Of TestClass, Integer) = Function(x As TestClass) x.I Dim orderByString As Func(Of TestClass, String) = Function(x As TestClass) x.S Dim q As IEnumerable(Of TestClass) = From t In lst Select t Console.WriteLine("======================== Order By Int ================") For Each t In q.OrderBy(orderByInt) Console.WriteLine("{0} : {1}", t.I, t.S) Next Console.ReadLine() Console.WriteLine("======================== Order By string ================") For Each t In q.OrderBy(orderByString) Console.WriteLine("{0} : {1}", t.I, t.S) Next End Sub Public Class TestClass Public I As Integer Public S As String Public Sub New(ByVal i As Integer, ByVal s As String) Me.I = i Me.S = s End Sub End Class End Module HTH -- Tom Shelton
From: Armin Zingler on 10 Jan 2010 04:53
Tom Shelton schrieb: > > I think the Mr. Arnold was implying something like this: > > Option Explicit On > Option Strict On > Option Infer On > > [...] Just wanted to say thank you so far only in the meantime because I haven't read/tried it yet because the problem has been solved as mentioned in my other replay. -- Armin |