c# – 将处理RegistryKey也关闭它吗?
发布时间:2020-12-15 08:48:42 所属栏目:百科 来源:网络整理
导读:正如标题所说. 另外,反过来;会关闭一个RegistryKey处理它吗? 我已经查看了我能找到的所有文档,并且在任何地方都没有提到这一点. 解决方法 它将调用Close()中的Dispose()方法,这意味着它将被“处理”,而Dispose()的其他方式将是Close()键.系统注册表项永远不
正如标题所说.
另外,反过来;会关闭一个RegistryKey处理它吗? 我已经查看了我能找到的所有文档,并且在任何地方都没有提到这一点. 解决方法
它将调用Close()中的Dispose()方法,这意味着它将被“处理”,而Dispose()的其他方式将是Close()键.系统注册表项永远不会关闭.只有正在关闭的键 – HKEY_PERFORMANCE_DATA.
Close方法的.NET源代码: /** * Closes this key,flushes it to disk if the contents have been modified. */ public void Close() { Dispose(true); } .NET source line 220 Dispose方法的.NET源代码: [System.Security.SecuritySafeCritical] // auto-generated private void Dispose(bool disposing) { if (hkey != null) { if (!IsSystemKey()) { try { hkey.Dispose(); } catch (IOException){ // we don't really care if the handle is invalid at this point } finally { hkey = null; } } else if (disposing && IsPerfDataKey()) { SafeRegistryHandle.RegCloseKey(RegistryKey.HKEY_PERFORMANCE_DATA); } } } .NET source line 227 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |