[Mono-dev] issue with delegate and annonymous methods
Dario Quintana
contacto at darioquintana.com.ar
Mon Jul 2 11:38:01 EDT 2007
Hi people,
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();
}
--
Dario Quintana
More information about the Mono-devel-list
mailing list