G
Guest
Hi guys,
what does "default" here mean? What is the MSDN Library Help URL related to
this explanation?
what does "default" here mean? What is the MSDN Library Help URL related to
this explanation?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Hardy said:Hi guys,
what does "default" here mean? What is the MSDN Library Help URL related to
this explanation?
Nicholas said:Tom,
It's not really the wrong way here, as the compiler allows it.
Granted, it is a little redundant, since you know what the default value
in this case is, but it's definitely not wrong.
Also, the default for a value type is if the default parameterless
constructor was called on it, which zeroes out the structure (so
references are null, other structure fields are zeroed out). It's not
just numeric types.
Tom Porterfield said:I didn't say it was wrong, just not quite right. Just because the
compiler allows it doesn't mean it's right.
I didn't say it was wrong, just not quite right. Just because the
compiler allows it doesn't mean it's right.
Didn't mean to infer that it was, sorry you misunderstood.
On the next interview you can ask, explain the difference between the
following:
int x = default(int);
int x = 0;
int x = new int();
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.