Can anybody tell me what is the default value of a variable at the time of declaration in C# and vb??
In c# you can use the default keyword to determine default values.
For example:
default(bool) default(int) default(int?)
Do you mean a (method) variable? or a field (on an instance or type)?
For a method-level variable (in C# at least) it is irrelevant, since "definite assignment" means that you must give it a value before you can read it.
Fields default to the bitwise zero state:
Nullable<T>
(int?
etc) that means nullIf 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