struct usage problem: Use of unassigned local variable

Bug #877312 reported by Leonid Batizhevsky
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mono (Ubuntu)
New
Undecided
Unassigned

Bug Description

I new in mono and C#. I try to use sample from book with struct ussage and get error:

using System;
namespace Proj
{
        public struct Point
        {
                private int _x;
                private int _y;
                public int X
                {
                        get {return _x;}
                        set {_x = value;}
                }
                public int Y
                {
                        get{return _y;}
                        set{ _y = value;}
                }
        }

        public class Program
        {
                public static void Main(string[] args)
                {
                        Point p;
                        Console.WriteLine(p.X);
                }
        }

}

$ mono-csc Program.cs
Program.cs(32,43): error CS0165: Use of unassigned local variable `p'
Compilation failed: 1 error(s), 0 warnings

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.