0
When and how is an object deleted?
6 ответов
+ 3
// An example to show 'Dispose'
...
{
...
// We call constructoe to create an object
TextBox myText = newTextBox;
...
// We use the object
myText.Text = "Hello!";
...
// We no longer need it
myText.Dispose();
...
}
...
// Hope it helps
+ 1
Objects are deleted when the block in which the object is created is ended with `}´ or the terminator is called. The terminator has the name of class preceeded by `~´. In C# Dispose method does it.
+ 1
If an object is disposable you can call the method to delete it before you reach the end of block
0
could u show me an easy example of how dispose work?
0
helped me a lot! thanks dude!
- 1
do you call the dispose method for the object itself or just call the dispose and it clears up?