How to delete object?

前端 未结 9 1553
眼角桃花
眼角桃花 2021-02-13 18:39

I need to create a method of class that delete the instance.

public class Car
{
    private string m_Color;

    public string Color
    {
        get { return m         


        
9条回答
  •  眼角桃花
    2021-02-13 18:44

    Use a collection that is a static property of your Car class. Every time you create a new instance of a Car, store the reference in this collection.

    To destroy all Cars, just set all items to null.

提交回复
热议问题