Re: [Evolution-hackers] Evolution.Contact.Set(ContactField field, IntPtr value)
- From: "Jacob Johnny" <jjohnny novell com>
- To: <krantz marcus gmail com>
- Cc: evolution-hackers gnome org
- Subject: Re: [Evolution-hackers] Evolution.Contact.Set(ContactField field, IntPtr value)
- Date: Thu, 04 Oct 2007 01:00:57 -0600
Hi Marcus,
On Sat, 2007-09-29 at 10:03 +0200, Marcus Krantz wrote:
> Hi all,
> I'm playing around a little bit Evolution-sharp. Since .NET is all new
> to me I have some problems setting fields of contact instances. I
> would really like to use the Set function but when I try I get
> compilation errors all the time. Consider the following snippet:
>
> Contact c = new Contact();
> ContactAddress addr = new ContactAddress();
IntPtr i = Marshal.AllocHGlobal(Marshal.SizeOf(addr));
>
> addr.Country = "Sweden";
> addr.Street = "Test";
> addr.Code = "SE-123 23";
> addr.Region = "Gothenburg";
>
> c.Set(ContactField.AddressWork, addr); // CS1503
> c.Set(ContactField.Email, "a b com"); //CS1503
>
Marshal.StructureToPtr (addr ,i, false);
c.Set(ContactField.AddressWork, i);
You need to free the allocated memory.
This may help :
http://www.mono-project.com/Interop_with_Native_Libraries
Regards,
Johnny
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]