Mono.CSharp.Evaluator.Run C# (CSharp) 메소드

Run() 공개 메소드

Executes the given expression or statement.
Executes the provided statement, returns true on success, false on parsing errors. Exceptions might be thrown by the called code.
public Run ( string statement ) : bool
statement string
리턴 bool
        public bool Run(string statement)
        {
            object result;
            bool result_set;

            return Evaluate (statement, out result, out result_set) == null;
        }

Usage Example

예제 #1
0
		public Shell(MainWindow container) : base()
		{
			this.container = container;
			WrapMode = WrapMode.Word;
			CreateTags ();

			Pango.FontDescription font_description = new Pango.FontDescription();
			font_description.Family = "Monospace";
			ModifyFont(font_description);
			
			TextIter end = Buffer.EndIter;
			Buffer.InsertWithTagsByName (ref end, "Mono C# Shell, type 'help;' for help\n\nEnter statements or expressions below.\n", "Comment");
			ShowPrompt (false);
			
			report = new Report (new ConsoleReportPrinter ());
			evaluator = new Evaluator (new CompilerSettings (), report);
			evaluator.DescribeTypeExpressions = true;
			
			evaluator.InteractiveBaseClass = typeof (InteractiveGraphicsBase);
			evaluator.Run ("LoadAssembly (\"System.Drawing\");");
			evaluator.Run ("using System; using System.Linq; using System.Collections; using System.Collections.Generic; using System.Drawing;");

			if (!MainClass.Debug){
				GuiStream error_stream = new GuiStream ("Error", (x, y) => Output (x, y));
				StreamWriter gui_output = new StreamWriter (error_stream);
				gui_output.AutoFlush = true;
				Console.SetError (gui_output);

				GuiStream stdout_stream = new GuiStream ("Stdout", (x, y) => Output (x, y));
				gui_output = new StreamWriter (stdout_stream);
				gui_output.AutoFlush = true;
				Console.SetOut (gui_output);
			}
		}
All Usage Examples Of Mono.CSharp.Evaluator::Run