Hy,
i know it sounds a very stupid question.
Here’s what i found:
public static List<SomeDTO> GetData(Guid userId, int languageId)
{
// Do something here
}
public static List<int> GetData(Guid userId ,int iNumberOfItems)
{
var result = GetData(userID,0);
return (from r in result select c.id).Take(iNumberOfItems).ToList<int>();
}
I get a compilation error:
ClassLibrary’ already defines a member called ‘GetData’ with the same parameter types
The second only returning the ids of the first function.
I know this isn’t working.
I know there’s both returning a List<> type ,but they returning differentypes.
Could somebody explain me why?
How can i solve this?
Update This problem is solved on F# !
You can’t override based on the return-type. If you look at your method signature, it looks like the following:
and
What you need to do is one of the following:
Now, when you call your function, the return type isn’t specified. And since the parameters look the same, the compiler doesn’t know which function to call. But it doesn’t need to make a guess, since the signatures are too similar it complains on compilation.