I was looking at some of the fine ASP.NET Hands-on Labs that will be waiting for people at some conference upcoming (and hopefully shortly thereafter on a dev center I've heard about). As I went through, this caught my eye:

public class BusinessObject


       public List<Employee> GetEmployeeList()


              EmployeeDB objEmp = new EmployeeDB();

              DataSet ds = objEmp.GetEmployees();

              List<Employee> emp = new List<Employee>();


              foreach(DataRow row in ds.Tables[0].Rows)


                     Employee obj = new Employee();

                     obj.EmployeeID = (int)row["EmployeeID"];

                     obj.FirstName = (string)row["FirstName"];

                     obj.LastName = (string)row["LastName"];




              return emp;



Without going into the merits of the code itself, we see Generics in action. w00

Now for a short side trip. When not specifically coding with a coworker, or for online use by other folk, I tend to code in whichever of the two official languages the environment picks for me. It does mean that occasionally I type the extra ';' or 'Dim', but it works, and keeps me from going completely stale. Sooooooo, as I was working on this lab, I realized I was in a VB.NET project. Where the rumours true? What would I do?

After a bit of digging around, I discovered:

Public Class BusinessObject
    Public Function GetEmployeelist() As List(Of Employee)
        Dim data As New EmployeeData
        Dim ds As DataSet
        Dim item As Employee
        Dim emps As New List(Of Employee)
        ds = data.GetEmployees
        For Each row As DataRow In ds.Tables("Employees").Rows
            item = New Employee
            With item
                .EmployeeID = Convert.ToInt32(row("EmployeeID"))
                .FirstName = row("FirstName")
                .LastName = row("LastName")
            End With
        Return emps
    End Function
End Class
Translation: Yes, doable in either official language (in fact, I would argue slightly more obvious what the template... oop, Generic ... is doing in VB.NET. Then again, maybe it's just my parenthetical style) w00 w00
TTFN - Kent