I am new to c# and am trying to dispose of objects taking up large amounts of memory as I've run memory profiling and need to dispose of some resources and call the finalize method for GC. However IDisposable cant implement my class why is this? and how should I implement IDispose to my class?
public class CellItem: IDisposable
{
public int MedicationDispenseId { get; set; }
public Enumerations.Timeslot Timeslot { get; set; }
public DateTime DateAdministered { get; set; }
public void dispose() {
if (this.MedicationDispenseId != null ) {
this.dispose();
}
if (this.Timeslot != null)
{
this.dispose();
}
if (this.DateAdministered != null)
{
this.dispose();
}
}
}