CA2202, how to solve this case

后端 未结 12 1122
闹比i
闹比i 2020-11-22 08:18

Can anybody tell me how to remove all CA2202 warnings from the following code?

public static byte[] Encrypt(string data, byte[] key, byte[] iv)
{
    us         


        
12条回答
  •  心在旅途
    2020-11-22 08:40

    The cryptostream is based on the memorystream.

    What appears to be happening is that when the crypostream is disposed (at end of using) the memorystream is also disposed, then the memorystream is disposed again.

提交回复
热议问题