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
You can use extension methods to achive this.
public static ObjRemoverExtension {
public static void DeleteObj(this T obj) where T: new()
{
obj = null;
}
}
And then you just import it in a desired source file and use on any object. GC will collect it. Like this:Car.DeleteObj()
EDIT Sorry didn't notice the method of class/all references part, but i'll leave it anyway.