Reputation: 2706
I'm hoping there's some clever way to do this. I have a generic base service that has several methods... So currently there are some methods in this base class like Create(T obj). What I'd like is for the compiler to create a more intuitive parameter name (based off of some rule) so that when a concrete instance of the base service is created like this:
public class ProductService : BaseService<Product>
I want it to compile the ProductService method to this (for example):
public Product Create(Product product)
instead of
public Product Create(Product obj)
I know it sounds minor but an intern asked me the other day and I couldn't tell him 100% sure that it wasn't possible.
Upvotes: 5
Views: 124
Reputation: 37980
As far as I know, there is no way of achieving this automatically. However, if you really wanted to do it anyway, you could make the method virtual
in BaseService
, and override it in each subclass:
public override Product Create(Product product) {
return base.Create(product);
}
Upvotes: 3