internal static object GetTaskData(V1Interop.ITask v1Task) { ushort DataLen; IntPtr Data; try { v1Task.GetWorkItemData(out DataLen, out Data); byte[] bytes = new byte[DataLen]; Marshal.Copy(Data, bytes, 0, DataLen); System.IO.MemoryStream stream = new System.IO.MemoryStream(bytes, false); System.Runtime.Serialization.Formatters.Binary.BinaryFormatter b = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); return b.Deserialize(stream); } catch { } return string.Empty; }