What is the default value of a variable declared as dynamic e.g. private dynamic banana;
?
Can I rely on the default()
function when the type is determined at runtime?
The reason I need to find the default value is that I declare a dynamic member of a class that I want to set it once (but not as readonly
), then use it many times.
How do I check if the dynamic variable has been set to anything other than the default value without knowing what the runtime type is likely to be?
Google came up with nothing on this :S
Thanks in advance.
It is null
.
dynamic blah;
Console.Write(blah); // crash
Console.Write(blah.GetType()); // NullRef
..is that what you meant?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With