As Oded already pointed out in his answer, it is not possible to overload the method when the only difference is the return type .
public override Stocks[] Search(string Field,string Param){
Think about it: how can the compiler know which variant of the method to call? This obviously depends on your search result, and obviously the compiler cannot know this in advance.
Actually what you need is one function that has two possible return types. What you do not want are two separate methods , because then you will need to decide which side to call. This is obviously the wrong approach.
One solution is to always return an array ; if only one Stocks object is found, you return an array of size 1.
stakx
source share