Drag-and-Drop multiple Attached File From Outlook to C# Window Form

I solve my problem Just add that code in any cs file. using System; using System.IO; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; using System.Text; using System.Reflection; using System.Windows.Forms; namespace iwantedue.Windows.Forms { public class OutlookDataObject: System.Windows.Forms.IDataObject { #region NativeMethods private class NativeMethods { [DllImport(“kernel32.dll”)] static extern IntPtr GlobalLock(IntPtr hMem); [DllImport(“ole32.dll”, PreserveSig = false)] public static extern … Read more

TPL TaskFactory.FromAsync vs Tasks with blocking methods

You absolutely want to use FromAsync when an API offers a BeginXXX/EndXXX version of a method. The difference is that, in the case of something like Stream or Socket or WebRequest, you’ll actually end up using async I/O underneath the covers (e.g. I/O Completion Ports on Windows) which is far more efficient than blocking multiple … Read more

Best ORM to use with C# 4.0 [closed]

UPDATE 2016 Six years later things are VERY different. NHibernate is all but abandoned, other alternatives were abandoned (eg Subsonic), Entity Framework is perhaps the most common full-featured ORM, and people have been moving to micro ORMs like Dapper for years, to map from queries to objects with a minimum of overhead. The application scenarios … Read more

Convert an int to bool with Json.Net [duplicate]

Ended up creating a converter public class BoolConverter : JsonConverter { public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { writer.WriteValue(((bool)value) ? 1 : 0); } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { return reader.Value.ToString() == “1”; } public override bool CanConvert(Type objectType) { return objectType == typeof(bool); } … Read more