Hungry Mind , Blog about everything in IT - C#, Java, C++, .NET, Windows, WinAPI, ...

How to cast null to a struct in C#

Оказывается, помимо магии с Nullable типами, компилятор C# 2.0 и выше разрешает еще и такое:

IntPtr intPtr = (IntPtr)null;

... что превращается в

IntPtr intPtr = IntPtr.Zero;

0 коммент.:

Отправить комментарий

Copyright 2007-2011 Chabster