/// <summary> /// Default constructor for creating InteropRecipientCollection. /// </summary> /// <param name="outer"></param> public InteropRecipientCollection(RecipientCollection outer) { _Count = outer.Count; if (_Count == 0) { _Handle = IntPtr.Zero; return; } // allocate enough memory to hold all recipients var size = Marshal.SizeOf(typeof(MapiMailMessage.MAPIHelperInterop.MapiRecipDesc)); _Handle = Marshal.AllocHGlobal(_Count * size); // place all interop recipients into the memory just allocated var ptr = (int)_Handle; foreach (var native in outer) { var interop = native.GetInteropRepresentation(); // stick it in the memory block Marshal.StructureToPtr(interop, (IntPtr)ptr, false); ptr += size; } }
/// <summary> /// Creates a blank mail message. /// </summary> public MapiMailMessage() { _RecipientCollection = new RecipientCollection(); _ManualResetEvent = new ManualResetEvent(false); _TaskScheduler = TaskScheduler.FromCurrentSynchronizationContext(); }