Isaiah's Blog

A vbCity Leader's journal

This blog hosted by:
http://blogs.vbcity.com      
  Home :: Syndication  :: Login

AprMay 2008Jun
SMTWTFS
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

Articles

Archives

Topics

Image Galleries

Blogs I Read

Having programmed in Visual Basic for a little over three years gives me a keen eye for the holes in others and likewise the holes in Visual Basic. I believe that each language is designed with a single purpose in mind and each language is catered to that purpose.

In school I am taking AP Computer Science and the curriculum is java programming. After the first few days I began to think that the people who designed java got half way through and just decided to throw in the towel. Having completed the second week of that class I am starting to think that java has too many holes to be used for anything.

This is where Visual Basic .Net 2005 comes into the picture. If I am going to have to use a language I want it to have some of the basic features. Java is lacking several different minor features. So I took the liberty of writing a for-each loop in Visual Basic .Net 2005.

Public Class VBforeach(Of c As {CollectionBase, New}, t)

 

    Public Delegate Sub foreachd(ByVal colType As t)

 

    Public Sub New()

        MyBase.New()

    End Sub

 

    Public Sub foreach(ByVal collection As c, ByVal colType As t)

        Dim handler As foreachd = AddressOf DelegateAction

        For Each colType In collection

            handler.Invoke(colType)

        Next

    End Sub

 

    Public Overridable Sub DelegateAction(ByVal colType As t)

        ' If this prints then there is not overrides

        System.Console.WriteLine("Hello, World")

        System.Console.ReadLine()

    End Sub

 

End Class

 

Now I know there is a select few people out there saying that this just some VB programmer ranting. After all this code can only run on a Windows based pc that has .Net Framework 2.0 installed. In all honsety this can be done in any other language so there is no point in getting angry about this.

 

This is just the beginning ...

posted on Sunday, August 22, 2004 1:25 PM