我已閱讀MSDN(see Important note)RSACryptoServiceProvider必須處置。他們給出的例子:如何手動配置RSACryptoServiceProvider?
現在我想包括RSACryptoServiceProvider到MyClass使用它的幾種方法。有了這個設置,我不能使用using語句。
相反,我嘗試調用.Dispose()方法的RSACryptoServiceProvider對象在適當的時間,但後來我得到的編譯錯誤消息:
`System.Security.Cryptography.AsymmetricAlgorithm.Dispose(布爾)'由於其保護級別而無法訪問
RSACryptoServiceProvider不應該被使用超過一個函數調用(使用using語句)嗎?
我該如何解決這個問題,是不是讓Dispose調用成爲一個選項?
@phq:或者,如果由於某種原因,您*堅持調用Dispose,然後將該值轉換爲IDisposable,然後調用Dispose處理結果。但更好的做文檔所說的並稱爲清除。 – 2010-03-19 22:20:09