在VisualStudio(InteliSense)中:如果接口实现的对象的typedef不是接口,如何在接口实现上将鼠标上的接口方法(属性或任何内容)描述为“可见”声明(例如var或在本例中是InterfaceImplementation)?
示例:
public interface Interface
{
/// <summary>
/// Description I like to write just once,
/// but like to have it "visible" in each implementation.
/// </summary>
void Method();
}
public class InterfaceImplementation : Interface
{
public void Method() { /* method impl without description */ }
}
class Program
{
static void Main( string[] args )
{
// on mouse over interfaceImplementation.Method() I can not see the Interface.Method description.
InterfaceImplementation interfaceImplementation = new InterfaceImplementation();
interfaceImplementation.Method();
// on mouse over varInterfaceImplementation.Method() I can not see the Interface.Method description.
var varInterfaceImplementation = new InterfaceImplementation();
varInterfaceImplementation.Method();
// only on mouse over interfaceRepresentation.Method() I can see the Interface.Method description.
Interface interfaceRepresentation = new InterfaceImplementation();
interfaceRepresentation.Method();
}
}