Let me start by saying that I do not advocate this approach, but I saw it recently and I was wondering if there was a name for it I could use to point the guilty party to. So h
Well, it's not an antipattern. The C++ standard library makes use of this feature and .NET even offers a special FunctionResult
class in the .NET framework. It's called Nullable
. Yes, this isn't restricted to function results but it can be used for such cases and is actually very useful here. If .NET 1.0 had already had the Nullable
class, it would certainly have been used for the NumberType.TryParse
methods, instead of the out
parameter.