[Mono-dev] issue with delegate and annonymous methods

Marek Safar marek.safar at seznam.cz
Mon Jul 2 12:05:55 EDT 2007


Hello Dario,

I could not reproduce the issue with SVN version of gmcs.
Can you try to use SVN version of gmcs ?

Regards,
Marek
> I'm using mono1.2.4, and I got this error when I run this application:
> http://darioquintana.com.ar/temp/monosms.zip
>
>       [csc] D:\monosms\src\Mono.Sms\Main.cs(281,49): error CS0103: The name `Age
> nda' does not exist in the context of `<>c__CompilerGenerated0'
>       [csc] Compilation failed: 1 error(s), 0 warnings
>
> The zip include the NAnt build file to compile.
>
> The class http://monosms.googlecode.com/svn/trunk/src/Mono.Sms/Main.cs
> works fine with this method:
>
>  private void btnAddContact_Click(object sender, EventArgs e)
>         {
>             Contacts frm = new Contacts();
>             frm.Operation = Operation.Add;
>
>             //bug en gmcs:
>             //frm.ContactsEventHandler += delegate(Contact contact,
> Operation op)
>             //                                {
>             //                                    Agenda.AddContact(contact);
>             //                                    LoadContacts();
>             //                                };
>
>             //Uso esto hasta que lo reparen !
>             frm.ContactsEventHandler += AddContact;
>
>             frm.ShowDialog();
>         }
>
> But with this I got the named exception:
>
>     private void btnAddContact_Click(object sender, EventArgs e)
>         {
>             Contacts frm = new Contacts();
>             frm.Operation = Operation.Add;
>
>             //bug en gmcs:
>             frm.ContactsEventHandler += delegate(Contact contact, Operation op)
>                                             {
>                                                 Agenda.AddContact(contact);
>                                                 LoadContacts();
>                                             };
>
>             //Uso esto hasta que lo reparen !
>             //frm.ContactsEventHandler += AddContact;
>
>             frm.ShowDialog();
>         }
>
>   




More information about the Mono-devel-list mailing list