C# The 'new' keyword on existing objects

后端 未结 9 507
一整个雨季
一整个雨季 2020-12-28 13:25

I was wondering as to what happens to an object (in C#), once its reference becomes reassigned. Example:

Car c = new Car(\"Red Car\");
c = new Car(\"Blue Car         


        
9条回答
  •  不思量自难忘°
    2020-12-28 13:57

    I think you should implement the IDispose interface to clean up unmanaged resources

    public class car : IDispose 
    

提交回复
热议问题