Search code examples
c#naming-conventionsnaming

Single and multiple method naming C#


I have a question about method naming. I have two methods:

private UserReport CreateUserReport(string userId, Report report)

private IEnumerable<UserReport> CreateUserReports(string userId, IEnumerable<Report> reports)

Should I add 's' to second method name or use CreateUserReport name for two methods, i.e. they will differ only in signature?


Solution

  • They do not only differ in signature but in their purpose as well. The one above generates single report while the one below generates multiple of them. I would strongly suggest that because of that you should use different names for them. For methods with the same name I think it would be advisable that return type should match and they only differ in parameters.