[Mono-dev] Bug? Inconsistent visibility for delegate type.
David Toso
erroneousbollock at gmail.com
Sat Jun 17 05:21:32 EDT 2006
Hi folks,
I'm not sure if this has been mentioned before (I could not find it in
the bug database) or wether I'm trying to do something that is
completely wrong... nonetheless:
When compiling the simple program below, I get the following errors:
bugTest.cs(20,25): error CS0051: Inconsistent accessibility:
parameter type `Foo.Bar.ProtectedBaz' is less accessible than method
Foo.Bar.<#AnonymousMethod>1 (Foo.Bar.ProtectedBaz)'
bugTest.cs(21,25): error CS0051: Inconsistent accessibility:
parameter type `Foo.Bar.PrivateBaz' is less accessible than method
`Foo.Bar.<#AnonymousMethod>2(Foo.Bar.PrivateBaz)'
It would seem that the visibility assigned to the delegate instances
is 'public', which results in the "Inconsistent accessibility" errors.
That code does compile (and work) in VS2005.
Is this really a bug, or is there some way I can modify the inline
delegate definitions such that they would have the correct visibility
?
I have mono version 1.1.13.6. (Ubuntu package: mono-gmcs 1.1.13.6-0ubuntu3)
Thanks for you time.
-David Toso
------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
namespace Foo
{
public class Bar
{
public class PublicBaz { public string id; }
protected class ProtectedBaz { public string id; }
private class PrivateBaz { public string id; }
private void Test()
{
string nice = "dave";
List<PublicBaz> pub = new List<PublicBaz>();
List<ProtectedBaz> prt = new List<ProtectedBaz>();
List<PrivateBaz> prv = new List<PrivateBaz>();
pub = pub.FindAll(delegate (PublicBaz b) { return b.id == nice; });
prt = prt.FindAll(delegate (ProtectedBaz b) { return b.id == nice; });
prv = prv.FindAll(delegate (PrivateBaz b) { return b.id == nice; });
}
public static void Main(string [] args)
{
(new Bar()).Test();
}
}
}
------------------------------------------------------------------------------
More information about the Mono-devel-list
mailing list