double meanings (c#): new, using, yield

In C#, a number of keywords are given 2 unrelated meanings.

using — typedef
using — name space import
——– unrelated to ———–
using — resource management (IDisposable)
Yield() — static method Thread.Yield()
——– unrelated to ———–
yield — iterator
new MyClass() — on class types
new MyStruct() — on struct types
** does NOT necessarily hit heap; See P55 [[c#preciely]]
** doesn’t return pointer;
** entirely optional. Only needed if you want to call the ctor of the struct.
**** without new, a value type object is created uninitialized when you declare the variable.
——– unrelated to ———–
new — redefine/hide a field, method, property etc
Not a keyword, but 2D-array in c# can be either jagged or a matrix


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s