I have two overloaded methods, one with params and one without. If I call that method without specifying any params, it hits the one with params all the same.
Take the following example:
public abstract class A<T>
{
public virtual T Get(int idEntity)
{
return this.DefaultRepository.Get(idEntity);
}
}
public class B<T> : A<T>
{
public override T Get(int idEntity)
{
this.DoSomeValidation();
var t = this.GetTheEntity();
return t;
}
public T Get(int idEntity, params sbyte[] AccessModifiers)
{
this.DoOtherValidations(AccessModifiers);
var t = this.GetTheEntity();
return t;
}
}
If I do this in another class:
public class SomeClass
{
public void SomeMethod(int idT)
{
var x = new B();
var t = B.Get(idT);
}
}
Then the method public T Get(int idEntity, params sbyte[] AccessModifiers)
is called, instead of public override T Get(int idEntity)
. I was expecting the latter to be called, it being more specific than the former, since I didn't specify any "params". Why is that? Thanks a lot.