更新时间:2023-11-05 17:08:22
如果班里有一个关闭
方法是完全一样的,因为这是正常执行的Dispose
。原来的Dispose
是隐藏在一个明确的实施,使完全相同的方法没有两个名字。
This is normally done if the class has a Close
method that is the exact same as Dispose
. The original Dispose
is hidden in an explicit implementation so that the exact same method doesn't have two names.
它的官方建议在这里:
Do如果这样的术语是标准的,例如作为与文件或插座实施清理目的的关闭方法。这样做的时候,建议您关闭执行相同的处置......
考虑实现接口成员明确隐藏的成员,并具有更好的名称添加对等成员。一>
偶尔特定的域名比的Dispose更合适。例如,一个文件封装可能希望使用的方法名称关闭。在这种情况下,私下实施处置,并创建调用Dispose公共关闭的方法。
(P.S。我不同意这个约定。)
(P.S. I disagree with this convention.)