Thread overview | |||||
---|---|---|---|---|---|
|
December 05, 2012 C# implementation of Nullable (May) | ||||
---|---|---|---|---|
| ||||
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. |
December 06, 2012 Re: C# implementation of Nullable (May) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jesse Phillips | Jesse Phillips: > It seems to be similar to that of std.typecons.Nullable with the following differences. Recently I've written something about Nullable: http://d.puremagic.com/issues/show_bug.cgi?id=9086 Bye, bearophile |
December 06, 2012 Re: C# implementation of Nullable (May) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jesse Phillips | On Wednesday, 5 December 2012 at 00:10:30 UTC, Jesse Phillips wrote: > 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/ > Also http://devtalk.net/csharp/chained-null-checks-and-the-maybe-monad/ |
Copyright © 1999-2021 by the D Language Foundation