ECMA-334: 12.1.5 Reference 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.5 Reference parameters

A parameter declared with a ref modifier is a reference parameter.

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

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

  • A variable shall be definitely assigned (§12.3) before it can be passed as a reference parameter in a function member invocation.
  • Within a function member, a reference parameter is considered initially assigned.

Within an instance method or instance accessor of a struct type, the this keyword behaves exactly as a reference parameter of the struct type (§14.5.7).


Today's Deals: Electronics

Personal tools