protected override void Dispose(bool disposing) { // If you need thread safety, use a lock around these // operations, as well as in your methods that use the resource. if (!_disposed) { if (disposing) { if (Birthdate != null) { Birthdate.Dispose(); } if (Surname != null) { Surname.Dispose(); } if (Surname2 != null) { Surname2.Dispose(); } if (GivenNames != null) { GivenNames.Dispose(); } if (IDNumber != null) { IDNumber.Dispose(); } if (_backgroundView != null) { _backgroundView.Dispose(); } } // Indicate that the instance has been disposed. Birthdate = null; Surname = null; Surname2 = null; GivenNames = null; IDNumber = null; _backgroundView = null; _disposed = true; } }