Ejemplo n.º 1
0
        /// <summary>
        ///   Generates a C# class implementing the decision tree.
        /// </summary>
        ///
        /// <param name="className">The name for the generated class.</param>
        ///
        /// <returns>A string containing the generated class.</returns>
        ///
        public string ToCode(string className)
        {
            using (MemoryStream stream = new MemoryStream())
            {
                TextWriter writer     = new StreamWriter(stream);
                var        treeWriter = new DecisionTreeWriter(writer);
                treeWriter.Write(this, className);
                writer.Flush();

                stream.Seek(0, SeekOrigin.Begin);
                TextReader reader = new StreamReader(stream);
                return(reader.ReadToEnd());
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///   Generates a C# class implementing the decision tree.
        /// </summary>
        ///
        /// <param name="className">The name for the generated class.</param>
        /// <param name="writer">The <see cref="TextWriter"/> where the class should be written.</param>
        ///
        public void ToCode(TextWriter writer, string className)
        {
            var treeWriter = new DecisionTreeWriter(writer);

            treeWriter.Write(this, className);
        }