tag:blogger.com,1999:blog-8643857899806162280.post4384411888718667822..comments2024-02-25T06:15:55.318-03:00Comments on Bug squash: Poor man's option type in C#Mauricio Schefferhttp://www.blogger.com/profile/15247972578064164206noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-8643857899806162280.post-27015784181171459292011-11-07T16:22:22.640-03:002011-11-07T16:22:22.640-03:00@Steve : Interesting, I didn't see the relatio...@Steve : Interesting, I didn't see the relation with the null-object pattern!<br />It seems we both agree that this is a poor-man's option type/maybe monad, so why not give <a href="https://github.com/fsharp/fsharpx" rel="nofollow">FSharpx</a> a try? ;-)Mauricio Schefferhttps://www.blogger.com/profile/15247972578064164206noreply@blogger.comtag:blogger.com,1999:blog-8643857899806162280.post-25941459050565490202011-11-07T12:46:04.725-03:002011-11-07T12:46:04.725-03:00It looks like this was an idea waiting to be (re-?...It looks like this was an idea waiting to be (re-?)discovered.<br /><br /><a href="http://stevegilham.blogspot.com/2011/11/c-null-object-pattern-and-poor-mans.html" rel="nofollow">The notion came to me</a> after I'd been tidying up some FxCop rule code where there's a lot of nested "if a property declared as a base type is of a certain derived type then use the derived type". I looked at the null-object pattern as a way to avoid the explicit null checks and ended up with the OfType<T>().Select() chain to avert the arrow anti-pattern.<br /><br />Then a few days after the fact, when it dawned on me that this was yet another case of "if monads did not exist, we would have to invent them", and, having not spotted this post in a search for Maybe monads in C#, wrote it up.Steve Gilhamhttps://www.blogger.com/profile/03622573187942388226noreply@blogger.com