C# implementation of Nullable (May)
Jesse Phillips
Jessekphillips+D at gmail.com
Tue Dec 4 16:10:29 PST 2012
This article goes over a Nullable/Optional/Maybe implementation
for C#.
http://twistedoakstudios.com/blog/Post1130_when-null-is-not-enough-an-option-type-for-c
http://www.reddit.com/r/programming/comments/14930f/when_null_is_not_enough_an_option_type_for_c/
It seems to be similar to that of std.typecons.Nullable with the
following differences.
The only way to get at the value is to call the Match function,
this takes a delegate to handle the value and one to handle the
absence of the value.
Most everything else is handled as helper functions residing
outside the type.
The get() method is implemented as helper ForceGetValue.
He also creates an Else function to provided the value or an
alternative if not available.
Sorry if bearophile already got to this one and I missed that.
More information about the Digitalmars-d-learn
mailing list