Jan Tielens' Bloggings
Joy, frustration, excitement, madness, aha's, headaches, ... codito ergo sum!
-
Simple Comparer for sorting in VB.NET
I don't know if something like this exists, or even is available in the .NET Framework itself, but I had to make a routine to sort a collection of objects, so I built a simple comparer class. The comparer class can be used like this:
Dim customers As New ArrayList
'Or you can use the Sort method of the strong typed collection,
'inheriting from CollectionBase.
customers.Sort(New SimpleComparer("Name"))
'or
customers.Sort(New SimpleComparer("Name", SortOrder.Descending))
The complete code for SimpleComparer class is:
Public Class SimpleComparer
Implements IComparer
Private _propertyToSort As String
Private _sortOrder As SortOrder
Public Sub New(ByVal propertyToSort As String)
Me.new(propertyToSort, System.Windows.Forms.SortOrder.Ascending)
End Sub
Public Sub New(ByVal propertyToSort As String, ByVal sortOrder As SortOrder)
MyBase.new()
_propertyToSort = propertyToSort
_sortOrder = sortOrder
End Sub
Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer _
Implements System.Collections.IComparer.Compare
Dim prop As Reflection.PropertyInfo = x.GetType.GetProperty(Me.PropertyToSort)
If Me.SortOrder = SortOrder.None OrElse prop.GetValue(x, Nothing) = _
prop.GetValue(y, Nothing) Then
Return 0
Else
If prop.GetValue(x, Nothing) > prop.GetValue(y, Nothing) Then
If Me.SortOrder = System.Windows.Forms.SortOrder.Ascending Then
Return 1
Else
Return -1
End If
Else
If Me.SortOrder = System.Windows.Forms.SortOrder.Ascending Then
Return -1
Else
Return 1
End If
End If
End If
End Function
Public Property SortOrder() As SortOrder
Get
Return _sortOrder
End Get
Set(ByVal Value As SortOrder)
_sortOrder = Value
End Set
End Property
Public Property PropertyToSort() As String
Get
Return _propertyToSort
End Get
Set(ByVal Value As String)
_propertyToSort = Value
End Set
End Property
End Class
-
Root Namespace and Project Imports in VB.NET solutions
Jonathan Goodyear blogs about problems he had when trying to create build scripts for VB.NET solutions.
-
VB.NET Property code generation macro in VS.NET.
A time ago, I read Duncan's post about macros in Visual Studio.NET. I altered a bit his macro to suit my needs. The macro lets you rapidly generate code for the properties of a class. For example when you type the following code for a class (Remark: The generated code has xml comments, but the formatting on this page does not show them.):
Public Class Customer
Private _name As String
Private _telephone As String
End Class
-
Hippo.NET Build Tool Released
Hippo.NET is a tool for streamlining the build process of .NET projects in a team envirionment. It provides continuous integration by monitoring the shared Visual SourceSafe database and starting the build process when changes are detected. An important design goal is to provide a nice and easy-to-use user interface, to monitor builds and trigger the build process when needed.
-
How to get a RSS feed in a DataSet in 1 line...
Working with XML is very cool in .NET! With only one line of code, you can get the contents of a RSS feed into a DataSet:
-
Hippo.NET Sneak Preview available for download!
Due to some requests, I've compiled a Sneak Preview version of Hippo.NET. Hippo.NET is a tool for streamlining the build process of .NET projects in a team envirionment. It provides continuous integration by monitoring the shared Visual SourceSafe database and starting the build process when changes are detected. An important design goal is to provide a nice and easy-to-use user interface, to monitor builds and trigger the build process when needed.
-
More about Hippo.NET
I've got some positive reactions about my announcement of a new build tool (Paul, I haven't told my manager yet about the tool we are using ;-).
-
Announcing Hippo.NET
Hippo.NET is an open source project for streamlining the build process of .NET projects in a team envirionment. It provides continuous integration by monitoring the shared Visual SourceSafe database and starting the build process when changes are detected. An important design goal is to provide a nice and easy-to-use user interface, to monitor builds and trigger the build process when needed. It can be compared by tools suchs as Draco.NET and Microsoft BuildIt.
-
The build tool choice
Last week we installed the duo NAnt and Draco.NET on our development server to streamline the build process of our lates project. This duo works quite nice, it took me about five 'failed builds' to set up the references in my first build file, but once you're used to it, it's get better. ;-) Draco.NET works fine, but I can't get the client app. to work, so I can't trigger builds from my own machine. Since we've set Draco.NET to check each 60 seconds, I only have to wait a couple of minutes to get my freshly compiled assembly.
-
Intresting open source project: shwow!DevStudio
Over here is a intresting project going on... shwow!DevStudio is an entirely web-based development environment to assist in file sharing and development cycles. They have a site where you can see it in action. Very nice work!