예제 #1
0
        /// <summary>Writes the specified formatter.</summary>
        /// <returns>A string value of the formatted object.</returns>
        /// <param name="formatter">The formatter.</param>
        /// <param name="spatial">The spatial object.</param>
        public static String Write(this SpatialFormatter <TextReader, TextWriter> formatter, ISpatial spatial)
        {
            Util.CheckArgumentNull(formatter, "formatter");

            StringBuilder builder = new StringBuilder();

            using (TextWriter writer = new StringWriter(builder, CultureInfo.InvariantCulture))
            {
                formatter.Write(spatial, writer);
            }

            return(builder.ToString());
        }
예제 #2
0
        /// <summary>Writes the specified formatter.</summary>
        /// <returns>A string value of the formatted object.</returns>
        /// <param name="formatter">The formatter.</param>
        /// <param name="spatial">The spatial object.</param>
        public static String Write(this SpatialFormatter <XmlReader, XmlWriter> formatter, ISpatial spatial)
        {
            Util.CheckArgumentNull(formatter, "formatter");

            StringBuilder     builder  = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings()
            {
                OmitXmlDeclaration = true
            };

            using (XmlWriter writer = XmlWriter.Create(builder, settings))
            {
                formatter.Write(spatial, writer);
            }

            return(builder.ToString());
        }