Ref Return No Local Variable - CSharp Language Basics

CSharp examples for Language Basics:ref

Description

Ref Return No Local Variable

Demo Code

using System;/*  w  ww. j  ava 2 s  .c  om*/
class RefReturnAsRefArgument
{
   static void Main()
   {
      int x = 10;
      RefReturn(ref RefReturn(ref RefReturn(ref x)))++;
      Console.WriteLine(x);
   }
   static ref int RefReturn(ref int p)
   {
      return ref p;
   }
}

Result


Related Tutorials