ECMA-334: 12.1.6 Output parameters

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search
C# Language Specification
© 2006 ECMA International

12.1.6 Output parameters

A parameter declared with an out modifier is an output parameter.

An output parameter does not create a new storage location. Instead, an output parameter represents the same storage location as the variable given as the argument in the function member invocation. Thus, the value of an output parameter is always the same as the underlying variable.

The following definite assignment rules apply to output parameters. [Note: The rules for reference parameters are different, and are described in §12.1.5. end note]

  • A variable need not be definitely assigned before it can be passed as an output parameter in a function member invocation.
  • Following the normal completion of a function member invocation, each variable that was passed as an output parameter is considered assigned in that execution path.
  • Within a function member, an output parameter is considered initially unassigned.
  • Every output parameter of a function member shall be definitely assigned (§12.3) before the function member returns normally.

Within an instance constructor of a struct type, the this keyword behaves exactly as an output or reference parameter of the struct type, depending on whether the constructor declaration includes a constructor initializer (§14.5.7).


Today's Deals: Electronics

Personal tools