I'm working on an interface named IService.
This interface replaces exist one and the application need to refer it as "Service" and not "IService" (I cannot change th开发者_StackOverflow社区e application code) I do not want to break the .Net naming conventions.
Is there a way to add attributes to interface do one defines it reference name?
If you really need keep the name Service for this interface, then you should just call it Service, and make sure its XML comment explains why you omitted the I.
Naming conventions are just that: conventions. As long as you make the reason for deviation clear, you don't need to follow them all the time.
Do the references in the application to Service
require it to be an interface (ie, class inheritance where a base class is already used)? Or could you just create a blank Service class and inherit your interface?
public interface IService {
//your code
}
public abstract class Service : IService {
}
If you need it to be an interface, then I'd go with dlev's answer. Conventions are just conventions.
精彩评论