This project is read-only.

MaybeNullable.If implementation differs from xml documentation


Version .NET 3 xml doc says that MaybeNullable.If returns null either source is null or condition is false.
But we can see that in this cases method is doing following:
return new TSource?(default (TSource));

Here we create default value of our source type and initialize nullable with that VALUE, so method returns default value instead of null.

I think that returning null could be better solution, cause we will get working correctly and nice other MaybeNullable methods with null.
So you can try something like:
return (TSource?)null;


Sergun wrote Jun 6, 2012 at 5:08 AM

Yes. It is my fail. I will fix it ASAP.
Thank you for feedback.