i new c# , trying dispose of objects taking large amounts of memory i've run memory profiling , need dispose of resources , call finalize method gc. idisposable cant implement class why this? , how should implement idispose 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(); } } }
c# case-sensitive, want name methods starting capital letter, i.e.
dispose
=> dispose
also have @ implement idisposable correctly , yet answer john skeet.