Ref Return As Ref Argument - CSharp Language Basics

CSharp examples for Language Basics:ref

Description

Ref Return As Ref Argument

Demo Code

using System;//from w  w  w  .  j av a2s. c om
using System.ComponentModel;
class RefReturnSimpleNoLocal
{
   static void Main()
   {
      int x = 10;
      RefReturn(ref x)++;
      Console.WriteLine(x);
   }
   static ref int RefReturn(ref int p)
   {
      return ref p;
   }
}

Result


Related Tutorials