Infinite state machine with an IDisposable
问题 Lets say I have an infinite state machine to generate random md5 hashes: public static IEnumerable<string> GetHashes() { using (var hash = System.Security.Cryptography.MD5.Create()) { while (true) yield return hash.ComputeHash(Guid.NewGuid().ToByteArray()); } } In the above example I use an using statement. Will the .Dispose() method ever be called? CQ, will the unmanaged resources ever be freed? For example, if I use the machine as follows: public static void Test() { int counter = 0; var