我试图为RSAKeyValue编写以下简单的扩展方法:
public static class RSAKeyValueExtensions
{
public static string ToXmlString(this RSAKeyValue keyValue)
{
return keyValue.GetXml().OuterXml;
}
}
但是,似乎每当我使用 时ToXmlString
,都会出现异常:
System.ObjectDisposedException:安全句柄已关闭
有没有办法封装,GetXml().OuterXml
所以它不会在我的代码中的各个地方重复而不得到一个ObjectDisposedException
?