Not sure if this is a silly question, but I just noticed this:
public interface IActivityDao : IDao<Activity>
{
IList<Activity> GetAllSinceSequence(long sequence, int count);
}
public class ActivityDao : AbstractNHibernateDao<Core.Domain.Activity>, IActivityDao
{
public IList<Activity> GetAllSinceSequence(long sequence, int maxRecords)
{
}
}
Inside of my implementation I have called my second parameter 'maxRecords.' Yet, in the interface, it is defined as 'count.' The compiler still consider the interface implemented, which is good, but can lead to a bit of ambiguity. Clearly, I should rename one of the parameters to match the other.
I played around a bit before making the rename and noticed something interesting. I'm not allowed to declare my interface as:
public interface IActivityDao : IDao<Activity>
{
IList<Activity> GetAllSinceSequence(long, int);
}
Is this just the compiler being overly protective against C# symantics? What purpose do the parameter names in an interface's method serve other than to make the code more readable? It seems to me that it invites ambiguity if the parameter names aren't forced upon implementations.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…