public static NSData ToNSData(this Image image, Imaging.ImageFormat format) { using (var stream = new IO.MemoryStream()) { image.Save(stream, format); return(NSData.FromArray(stream.ToArray())); } }
/// <summary> /// Serializes the user. /// </summary> /// <param name="aum">The AuthUserData.</param> /// <returns></returns> /// <remarks>The AuthUserData is a custom serializable poco that holds the data</remarks> private static string SerializeUser(AuthUserData aud) { Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new Runtime.Serialization.Formatters.Binary.BinaryFormatter(); IO.MemoryStream mem = new IO.MemoryStream(); bf.Serialize(mem, aud); return(Convert.ToBase64String(mem.ToArray())); }