I’ve been playing around with generics in .NET 2.0, using VB.NET Express 2005.
One problem I’ve come across is that I can’t find a way around syntax like this:
Dim P As Pair(Of Integer, Integer) = Pair(Of Integer, Integer).MakePair(5, 6)
Is it possible to get close to the C++ equivalent?
pair<int, int> p = make_pair(5, 6);
I’ve also noticed a few problems which make it trickier to implement some
simple STL-like constructs. For example, there’s no String.New(),
so I can’t restrict my Pair class to {New,
IComparable} - I have to take it down to IComparable. This
means I can’t do: New Pair(Of String, String).