Main Site Documentation

Disposing of SPI


Ive created a driver class for an spi device

I need to initiate the class then dispose of it and re-initialise… over and over.

I set the current instance class to null and it still complains.

On re-entry at the class creation

this.spi = new SPI(config);

I cant seem to set the instance of spi to null
and there is no dispose option.
Does my class need a destructor?


Setting the class to null does NOT invoke the SPI class destructor right away. This happens at garbage collection time.

Try forcing garbage collection by calling Debug.GC(true). This will cause garbage collection to occur and the destructor of the SPI class to be called.


Sorry ignore that post

I just created a funtion within the class to remove the SPI instance…


Thanks any way Mike! I just keep thinking C++