[antlr-interest] Value types - can't be set to null in C#

Gavin Lambert antlr at mirality.co.nz
Mon Jan 7 16:40:37 PST 2008


At 12:38 8/01/2008, Johannes Luber wrote:
 >"Small" bug indeed... The entire problem is based on the fact,
 >that there is only a limited map in CSharp.stg, which includes
 >basically only the inbuilt value types (edited to include
 >DateTime):
[...]
 >The default is, as you see, null. Adding new types to this
 >structure is an open-ended task.

Does C# 2.0's "default" keyword work outside generic contexts?  If 
so, you could just always initialise everything as:

   Type x = default(Type);



More information about the antlr-interest mailing list