Is a bad practice to Return different types when overloading a method?

Given this example:

Interface CustomersDao
    Function Get(ByVal Id As Integer) As Customer
    Function Get(ByVal Filter As Filter) As IList(Of Customer)
End Interface

Public Sub Main()
    Dim Customer As Customer = CustomersDao.Get(4)

    Dim Filter As New CustomersDao.Filter
    Filter.Category = 2
    Dim Customers As IList(Of Customer) = CustomersDao.Get(Filter)
End Sub

Is it a bad practice to return diferent types in the same method?

7
задан Cœur 1 March 2017 в 15:35
поделиться