I was trying to write the following simple extension method for RSAKeyValue:
public static class RSAKeyValueExtensions
{
public static string ToXmlString(this RSAKeyValue keyValue)
{
return keyValue.GetXml().OuterXml;
}
}
However, it seems whenever I use ToXmlString
, I get an exception:
System.ObjectDisposedException: Safe handle has been closed
Is there a way to encapsulate the GetXml().OuterXml
so it isn't repeated in various places in my code without getting an ObjectDisposedException
?