csharp(1) General Commands Manual csharp(1) (NAME) csharp - C# (SYNOPSIS) csharp [--attach PID] [-e EXPRESSION] [file1 [file2]] [compiler- options] [--|-s script-options] (DESCRIPTION) csharp C# C# C# . mcs . . Mono 2.10 csharp . C# : #!/usr/bin/csharp Console.WriteLine ("Hello, World"); Mono 5.0 -s -- ( ) csharp . -s shebang ( Mono 2.10) . : #!/usr/bin/csharp -s foreach (var arg in Args) Console.WriteLine ($"script argument: {arg}"); (OPTIONS) mcs . : -s SCRIPT_FILE shebang . . Args . : #!/usr/bin/env csharp -s -- Args . : csharp -- a b c { "a", "b", "c" } = Args . --attach (multi-threading) . csharp . C# (thread) . . -e EXPRESSION C# EXPRESSION ..SH " (OPERATION)" csharp : $ csharp Mono C# Shell, type "help;" for help Enter statements below. csharp> C# System System.Linq System.Collections System.Collections.Generic . using : csharp> new XmlDocument (); (1,6): error CS0246: The type or namespace name `XmlDocument' could not be found. Are you missing a using directive or an assembly reference? csharp> using System.Xml; csharp> new XmlDocument (); System.Xml.XmlDocument Mono.CSharp.InteractiveBase . . "help" : csharp> help; "Static methods: LoadPackage (pkg); - Loads the given Package (like -pkg:FILE) [...] ShowVars (); - Shows defined local variables. ShowUsing (); - Show active using decltions. help; " csharp> C# : csharp> Math.Sin (Math.PI/4); 0.707106781186547 csharp> 1+1; 2 csharp> "Hello, world".IndexOf (','); 5 C# ToString() ToString() System.Object : csharp> var a = new XmlDocument (); csharp> a; System.Xml.Document csharp> csharp> a.Name; "#document" csharp> System.Collections.Hashtable System.Collections.IEnumerable IDictionary C# ToString() : csharp> var pages = new Hashtable () { > { "Mono", "http://www.mono-project.com" }, > { "Linux", "http://kernel.org" } }; csharp> pages; {{ "Mono", "http://www.mono-project.com" }, { "Linux", "http://kernel.org" }} System.Linq LINQ C# . /tmp : csharp> using System.IO; csharp> var last_week = DateTime.Now - TimeSpan.FromDays (7); csharp> var old_files = from f in Directory.GetFiles ("/tmp") > let fi = new FileInfo (f) > where fi.LastAccessTime < LastWeek select f; csharp> : csharp> using System.IO; csharp> var last_week = DateTime.Now - TimeSpan.FromDays (7); csharp> from f in Directory.GetFiles ("/tmp") > let fi = new FileInfo (f) > where fi.LastAccessTime < last_week select f; [...] csharp> LINQ IEnumerable (on-demand) . "from" IEnumerable . IEnumerable IEnumerable . IEnumerable . C# : csharp> var a = 1; csharp> a.GetType (); System.Int32 csharp> var a = "Hello"; csharp> a.GetType (); System.String csharp> ShowVars (); string a = "Hello" : csharp> var protocols = new string [] { > "ftp", > "http", > "gopher" > }; csharp> protocols; { "ftp", "http", "gopher" } Control-C : csharp> var done = false; csharp> while (!done) { } Interrupted! System.Threading.ThreadAbortException: Thread was being aborted at Class1.Host (System.Object& $retval) [0x00000] at Mono.CSharp.InteractiveShell.ExecuteBlock (Mono.CSharp.Class host, Mono.CSharp.Undo undo) [0x00000] csharp> C# . Gtk# . ( ) Emacs . : Home Control-a . End Control-e . Control-b . Control-f . Control-p . Control-n . Return . Control-C . . Backspace . Delete Control-d . Control-k . Alt-D . Alt-d . Control-Y (kill buffer) . Control-Q (quote) . . Control-Q . Control-D . . (STATIC PROPERTIES AND METHODS) (static) . : Args -s -- . -s . void LoadAssembly(string assembly) . -r: . void LoadPackage(string package) . -pkg: . string Prompt { get; set } . "csharp> " . string ContinuationPrompt { get; set } . void ShowVars() . csharp (shadowing) C# . void ShowUsing() using . TimeSpan Time (Action a) . Action TimeSpan . : csharp> Time (() => { for (int i = 0; i < 5; i++) Console.WriteLine (i);}); 0 1 2 3 4 00:00:00.0043230 csharp> TimeSpan (benchmarking) ..SH " (GUI METHODS AND PROPERTIES)" (GUI) . Gtk.Container "PaneContainer" Gtk# "MainWindow" (toplevel) . (STARTUP FILES) C# Mono C# ~/.config/csharp Unix . . C# .cs ( Mono 2.0). dll . (AUTHORS) Mono C# Miguel de Icaza Ravi Pratap Martin Baulig Marek Safar Raja Harinath . Ximian Novell Marek Safar . (LICENSE) Mono GNU GPL MIT X11 . `COPYING` . Novell . (SEE ALSO) gmcs(1), mcs(1), mdb(1), mono(1), pkg-config(1) (BUGS) : http://www.mono- project.com/community/bugs (MAILING LIST) Mono http://www.mono-project.com/community/help/mailing-lists . (MORE INFORMATION) Mono C# Novell (http://www.novell.com) ECMA C# : http://www.ecma.ch/ecma1/STAND/ecma-334.htm Mono C# http://www.mono-project.com/docs/about- mono/languages/csharp C# http://mono- project.com/docs/tools+libraries/tools/repl . 22 March 2017 csharp(1)