我想知道应该在哪里应用我的XML注释。我应该把更通用的XML注释放在接口上,把更详细的注释放在实现类上吗?就像这样:
public interface IObjectRepository
{
/// <summary>
/// Returns an object from the respository that contains the specified ID.
/// </summary>
Object GetObject(int Id);
}
public ObjectRepository : IObjectRepository
{
/// <summary>
/// Retrieves an object from the database that contains the specified ID.
/// </summary>
public Object GetObject(int Id)
{
Object myData = // Get from DB code.
return myData;
}
}
出于简单起见,我没有包含<param>
。
这是一种好的注释实践方法吗?还是有其他不同的方式?我只需跳过接口的注释吗?