CA 2202,如何解决这个案子
public static byte[] Encrypt(string data, byte[] key, byte[] iv){ using(MemoryStream memoryStream = new MemoryStream()) { using (DESCryptoServiceProvider cryptograph = new DESCryptoServiceProvider()) { using (CryptoStream cryptoStream = new CryptoStream(memoryStream, cryptograph.CreateEncryptor(key, iv), CryptoStreamMode.Write)) { using(StreamWriter streamWriter = new StreamWriter(cryptoStream)) { streamWriter.Write(data); } } } return memoryStream.ToArray(); }}
警告7 CA 2202:Microsoft.Usage:Object‘crypStream’可以在方法‘CryptoServices.Encrypt(字符串、字节[])中多次释放。若要避免生成System.ObjectDisposedException,不应对象调用Dispose超过一次。:行:34
警告8 CA 2202:Microsoft.Usage:Object‘MemyStream’可以在方法‘CryptoServices.Encrypt(字符串、字节[])中多次释放。若要避免生成System.ObjectDisposedException,不应对象调用Dispose超过一次。:行:34、37
UYOU