The compatibility docs on the gotdotnet site seem to indicate that
accessibility modifiers will now be honored by delegates.  See the
following:
http://www.gotdotnet.com/team/changeinfo/Backwards1.0to1.1/default.aspx#0000
0139
<http://www.gotdotnet.com/team/changeinfo/Backwards1.0to1.1/default.aspx#000
00139>

I've downloaded 1.1 to test this and it doesn't seem to be true.  Can anyone
tell me what is going on?  Code looks like this:

using System;

public class AppMain
{
 static public void Main()
 {
  Bar oBar = new Bar();
  Foo oFoo = new Foo(oBar);
  oBar.Fire();
 }
}

public class Foo
{
 public Foo(Bar voBar)
 {
  voBar.Baz += new EventHandler(HandlePriv);
  voBar.Baz += new EventHandler(HandlePub);
 }

 private void HandlePriv(object sender, EventArgs e)
 {
  Console.WriteLine("Private handlers still work");
 }

 public void HandlePub(object sender, EventArgs e)
 {
  Console.WriteLine("Public handlers work");
 }

}

public class Bar
{
 public event EventHandler Baz;

 public void Fire()
 {
  if(Baz != null)
   Baz(this, new EventArgs());
 }
}

Thanks very much,
Ed


You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to