M
M
Mozzarella2017-07-05 23:05:34
visual studio
Mozzarella, 2017-07-05 23:05:34

How to release Control's resources without calling the constructor?

When Dispose() is called, the Control'a constructor is called. Can this be fixed, and if so, how.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
Tom Nolane, 2017-07-05
@sfreaky

1) Control = null;
2) grid1.Children.Remove(Control);
3) //if WPF Control.Visibility = Visibility.Hidden;
//if WindowsForm
Control.Visible = false;

R
Roman, 2017-07-08
@yarosroman

Maybe a destructor? IDisposable is made to deallocate unmanaged resources, as the GC is not good at deallocating them. https://metanit.com/sharp/tutorial/8.2.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question