Ejemplo n.º 1
0
        /// <summary>
        ///     Saves a property list with the given object as root in XML format into an output stream.
        /// </summary>
        /// <param name="root">The root object.</param>
        /// <param name="outStream">The output stream.</param>
        /// <exception cref="IOException">When an error occurs during the writing process.</exception>
        public static void SaveAsXml(NSObject root, Stream outStream)
        {
            #if NET40
            // The StreamWriter constructor which takes a "leaveOpen" parameter is
            // not available on .NET 4.0
            StreamWriter w = new StreamWriter(outStream, Encoding.UTF8);
            w.Write(root.ToXmlPropertyList());
            w.Close();
#else
            using (StreamWriter w = new StreamWriter(outStream, Encoding.UTF8, 1024, true))
                w.Write(root.ToXmlPropertyList());
            #endif
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Saves a property list with the given object as root in XML format into an output stream.
        /// </summary>
        /// <param name="root">The root object.</param>
        /// <param name="outStream">The output stream.</param>
        /// <exception cref="IOException">When an error occurs during the writing process.</exception>
        public static void SaveAsXml(NSObject root, Stream outStream)
        {
#if NET40
            // The StreamWriter constructor which takes a "leaveOpen" parameter is
            // not available on .NET 4.0
            StreamWriter w = new StreamWriter(outStream, Encoding.UTF8);
            w.Write(root.ToXmlPropertyList());
            w.Close();
#else
            using (StreamWriter w = new StreamWriter(outStream, Encoding.UTF8, bufferSize: 1024, leaveOpen: true))
            {
                w.Write(root.ToXmlPropertyList());
            }
#endif
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Saves a property list with the given object as root in XML format into an output stream.
 /// </summary>
 /// <param name="root">The root object.</param>
 /// <param name="outStream">The output stream.</param>
 /// <exception cref="IOException">When an error occurs during the writing process.</exception>
 public static void SaveAsXml(NSObject root, Stream outStream)
 {
     StreamWriter w = new StreamWriter(outStream, Encoding.UTF8);
     w.Write(root.ToXmlPropertyList());
     w.Close();
 }