Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


What about C# nullable types?

  • Note that System.Nullable<T> is a .NET Framework library feature, and that C# only added syntactic sugar to turn "T?" into "Nullable<T>".  Also note that generics are CLS compliant in the CLI version 2.  So Nullable<T> should be consumable in all (CLS-compliant) languages (20+) targeting the CLI.

    • .NET 2.0 nullable types main aim is to give a way to express null values for all value-types:
      - the built-in types
      - the value-types of the Framework (as Guid)
      - every value-types that a programmer can code.

      To reach this result, the Generics _must_ be used even if current (.NET 2.0) Generics implementation have limitations (*).

      To overcome these limitations and to make .NET 2.0 nullable types really usable, specific compiler extensions have been mandatory: C# compiler Nullable Types extensions are not "syntactic sugar" instead are essential features.
      Because of this, different compilers can choose not to implement Nullable Types extensions or implement them with different synatax (**)

      The SourceForge NullableTypes main aim is to enable built-in types to have null value.
      So they do not need to use Generics, do not suffer Generics limitation so they are more sililar to the original built-in types (then the .NET 2.0 nullable types), they follow the Null Object pattern (while .NET 2.0 nullable types don't) and they are usable in  .NET Framework 1.x and with the same syntax for all languages (while .NET 2.0 nullable types don't).

      Off course .NET 2.0 nullable types reduce the needs for Source Forge NullableTypes but still remain situations where NullableTypes are still useful. And next version of NullableTypes will add compatibility to .NET 2.0 nullable types so projects that are developed with NullableTypes wont need any port to use .NET 2.0 nullable types.

      I'm proud to have realized in 2003 a features that was missing and that was so important that in 2005 MS is adding it to the .NET and to the wonderful C# language. ;-)

      - - - - - - - - - - - - - - - - -
      (*) with Google you can find a lot of comparison between C++ Templates and C# Generics (here is 1 in italian: http://blogs.ugidotnet.org/luka/archive/2005/03/09/12078.aspx\)
      (**) Note that types that use nullable types compiled compiled in a managed language can be used by any other managed language even if that language do not have Nullable Types extensions.

  • aaaa