我对应该在哪里应用我的 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>
为了简单起见,我没有包括在内。
这是评论的好习惯还是有不同的方式?我只是跳过评论界面吗?