How can convert this C# code to C++/CLI
问题 How can I convert this segment of C# code to C++/CLI: protected string GetMD5HashFromFile(string fileName) { FileStream file = new FileStream(fileName, FileMode.Open); MD5 md5 = new MD5CryptoServiceProvider(); byte[] retVal = md5.ComputeHash(file); file.Close(); ASCIIEncoding enc = new ASCIIEncoding(); return enc.GetString(retVal); } Specially this part byte[] retVal = md5.ComputeHash(file); 回答1: Making liberal use of the stack semantics available in C++/CLI to automatically dispose objects.