Generic overloading tells me this is the same function. Not agree.
Posted
by serhio
on Stack Overflow
See other posts from Stack Overflow
or by serhio
Published on 2010-03-23T11:33:53Z
Indexed on
2010/04/01
20:53 UTC
Read the original article
Hit count: 175
base class:
Class List(Of T)
Function Contains(ByVal value As T) As Boolean
derived class:
Class Bar : List(Of Exception) ' Exception type as example '
Function Contains(Of U)(ByVal value As U) As Boolean
compiler tells me that that two are the same, so I need to declare Overloads/new this second function.
But I want use U to differentiate the type (one logic) like NullReferenceException, ArgumentNull Exception, etc. but want to leave the base function(no differentiation by type - other logic) as well.
© Stack Overflow or respective owner