[Mono-bugs] [Bug 79637][Nor] New - CS1540 error when accessing protected property of base class

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Oct 10 18:22:55 EDT 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by steve_merel at playstation.sony.com.

http://bugzilla.ximian.com/show_bug.cgi?id=79637

--- shadow/79637	2006-10-10 18:22:55.000000000 -0400
+++ shadow/79637.tmp.15984	2006-10-10 18:22:55.000000000 -0400
@@ -0,0 +1,43 @@
+Bug#: 79637
+Product: Mono: Compilers
+Version: 1.1
+OS: SUSE 9.2
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: steve_merel at playstation.sony.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: CS1540 error when accessing protected property of base class
+
+Compiling the file below reports this error:
+
+MyCollection.cs(8,15): error CS1540: Cannot access protected member
+`System.Collections.ObjectModel.Collection<T>.Items' via a qualifier of
+type `MyCollection<T>'; the qualifier must be of type `MyCollection<T>' (or
+derived from it)
+
+The Items property is a protected property of the base class Collection<T>
+and should be accessible from derived classes.
+
+Steps to reproduce the problem:
+
+gmcs MyCollection.cs
+
+------------------------------------------
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+
+public class MyCollection<T> : Collection<T>
+{
+    public void Foo()
+    {
+        T t = Items[0];
+    }
+}


More information about the mono-bugs mailing list