Any way to constrain generics to value types?

Is there a way that I can constrain a generic type to only accept either integers or doubles? Seems like value types are altogether exluded from participating in generics but I wanted to make sure. Is this right? Any reasons that explain this?I'd like to write something like:

Private Sub Foo(Of T As {Integer, Double})(ByVal Value As T)

Thanks in advance!

[764 byte] By [GDM] at [2007-12-16]
# 1
Hi, what is near is that you can limit it to structures (value types) as follows Public Shared Sub Foo(Of T As {Structure})(ByVal Value As T) End Sub Another thing is that if you just allow Doubles (as you can't have value type as such straight, then custom Double collection with built-in generic collection classes could be a solution as well), wouldn't Integers go there too (Integer can always be converted implicitly to a Double)? -- Teemu Keiski ASP.NET MVP, AspInsider Finland, EU http://blogs.aspadvice.com/joteke
MVPUser at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic General...