4 ms·
More idiomatic C# might be: int result; if (foo.TryAndGetSomeNumber(out result)) doSomething(result); There might also be a foo.GetSomeNumber() that r
by bmm6o 15y ago
More idiomatic C# might be:
int result;
if (foo.TryAndGetSomeNumber(out result))
doSomething(result);
There might also be a foo.GetSomeNumber() that returns an int or throws on failure.
[fixed formatting]
- troygoode 15y agoI disagree that your example is more idiomatic. Maybe pre-3.0...