Posts tagged 'what-s-wrong-with-this-code'

What's wrong with this generic class?

Q: What's wrong with the below generic class? VB.NET Imports System.Data Imports System.Web Public Class GenericClass( Of T As DataTable) Public Function GetValue( ByVal val As T) As T Return val End Function Public Function GetValue( ByVal val As T) As DataTable Return val End Function Public Sub GetValue...

Continue reading "What's wrong with this generic class?"

What's wrong with this generic type?

I love mysteries. However, this one is pretty simple. Q: What is wrong with the following generic type? VB.NET Public Class BaseClass( Of K, V) End Class Public Class SubClass1 Inherits BaseClass( Of K, V) End Class Public Class SubClass2 Inherits BaseClass( Of Integer , Long ) End Class C# public class...

Continue reading "What's wrong with this generic type?"