danielwertheim / Ensure.That

Guard clause project for .NET
MIT License
439 stars 49 forks source link

Return Guid from string.IsGuid #149

Closed ndrwrbgs closed 3 years ago

ndrwrbgs commented 3 years ago

Why

Our code was like Ensure.That().IsGuid(); return new Guid();

No big deal, but knowing that IsGuid already constructed the Guid and we do it again felt weird enough to bother mentioning here.

Ideating

Not actually saying "let's do this" just opening the floor for discussion on it.

Depends if it matches the style elsewhere in the library, but if it's not a crazy deviation, might consider it.

If nothing else returns the value, we should not, as it enables us to later do something like enable chaining validations, which wouldn't be possible if this returned the value

Though, perhaps as an out parameter?