|
-
Apr 4th, 2013, 09:22 PM
#10
Re: [RESOLVED] Freaky thing with Point type.
This is from the MSDN documentation for the Nothing keyword:
For non-nullable value types, Nothing in Visual Basic differs from null in C#. In Visual Basic, if you set a variable of a non-nullable value type to Nothing, the variable is set to the default value for its declared type. In C#, if you assign a variable of a non-nullable value type to null, a compile-time error occurs.
Basically, 'null' in C# specifically means a null reference while Nothing in VB means the default value for the type, which is a null reference for reference types and something else for value types.
 Originally Posted by formlesstree4
Besides, if you want to assign a default value to a value type (or any time, for that matter), C# has default(T), not sure if VB has an equivalent.
default(T) was added to C# when generics were added because C# had no existing way to create a default value for an arbitrary type. VB already did, i.e. Nothing, so there was no need to add anything new.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|