[Mono-bugs] [Bug 355163] New: Pre or post incrementing a nullable property throws compile error (CS0131)

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Jan 21 18:52:14 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=355163


           Summary: Pre or post incrementing a nullable property throws
                    compile error (CS0131)
           Product: Mono: Compilers
           Version: 1.2.6
          Platform: i686
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: guerrics at mindtouch.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Submitted by Mindtouch

Summary:

When trying to pre or post increment a nullable property, compliation fails
with the following error message:
error CS0131: The left-hand side of an assignment must be a variable, a
property or an indexer


Code Sample:

using System;
namespace BugReport {
    class Program {
        static void Main(string[] args) {
            A a = new A();
            a.Counter++;                // fails
            ++a.Counter;                // fails
            a.Counter = a.Counter + 1;  // succeeds
        }
    }

    class A {
        private int? _counter;
        public int? Counter {
            get { return _counter; }
            set { _counter = value; }
        }
    }
}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list