+ 1

If object is null, what happens?

If a create a object and set it with null, we have the same destructors result?

27th Jul 2016, 4:46 AM
Ricardo Pucca
Ricardo Pucca - avatar
5 Answers
+ 1
null basically means no value. If you set a variablr to null, it won't carry a value.
27th Jul 2016, 5:08 AM
Andreas BeEm Kvist
Andreas BeEm Kvist - avatar
+ 1
Ok Yoann and Andreas, I thought that assign a object with null or nothing was the same, but are diferences! Thanks.
28th Jul 2016, 8:49 PM
Ricardo Pucca
Ricardo Pucca - avatar
+ 1
Nothing is the key word for VB .Net and Null is for C#
29th Jul 2016, 5:12 AM
Yoann Melchior
Yoann Melchior - avatar
0
do not care about the destructors at the beginning... destructors are used for memory fine tuning but basically they are not so often very useful. If you try to access a property of a null object you will get an error. so you have to be sure it' not null before using it or use try/catch to manage this in the catch. but most of the time you have to be sure it' is not null with a simple test : if xx == nothing.
27th Jul 2016, 4:24 PM
Yoann Melchior
Yoann Melchior - avatar
0
i think whit null only reserve the space in memory and whit destructors delete the space
11th Nov 2016, 6:38 AM
Jorge Gerardo Ortiz Muñoz
Jorge Gerardo Ortiz Muñoz - avatar