Skip to content
Knowledge Base
Česky

.NET Framework · Puzzle

C# Puzzle: out parameters

Robert Haken 1 min read Markdown ↓

This method usually outputs false.
Can you imagine a situation where it outputs true?

[code lang=”csharp” light=”true”]
static bool Test(out int x, out int y)
{
x = 123;
y = 45;
return (x == y);
}
[/code]

You can find the solution in .NET Fiddle.

Robert Haken · HAVIT Software Architect, Founder at HAVIT, Microsoft MVP - ASP.NET/IIS.
Has 53 articles in the knowledge base.
All articles by this author →
HAVIT
Read next
Discussion

Leave a reply