Example #1
0
 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()));
     }
 }
Example #2
0
 /// <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()));
 }