[ubuntu-mono] [Bug 877312] [NEW] struct usage problem: Use of unassigned local variable

Leonko 877312 at bugs.launchpad.net
Tue Oct 18 10:37:27 UTC 2011


Public bug reported:

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

** Affects: mono (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
CLI/Mono Uploaders, which is subscribed to mono in Ubuntu.
https://bugs.launchpad.net/bugs/877312

Title:
  struct usage problem: Use of unassigned local variable

Status in “mono” package in Ubuntu:
  New

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 manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mono/+bug/877312/+subscriptions




More information about the Ubuntu-mono mailing list