Ref Local Variable - CSharp Language Basics

CSharp examples for Language Basics:ref

Description

Ref Local Variable

Demo Code

using System;//from ww  w.  j  a  v  a  2 s .  co  m
using System.ComponentModel;
public class RefLocalIntro
{
   static void Main()
   {
      int x = 10;
      ref int y = ref x;
      x++;
      y++;
      Console.WriteLine(x);
   }
}

Result


Related Tutorials