0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

中古ノート、買ってみた。 その36

Last updated at Posted at 2025-10-17

概要

中古ノート買ってみた。
wsl1のubuntu18.04にmono入れてみた。
Mono付属のcsharpコマンドを使ってみた。

Monoのcsharpコマンドを使ってみた。

csharpは、C#のインタラクティブシェルです。
これはMono C#インタプリタで、C#のコードをその場で実行したりテストしたりするのに便利です。
コード補完も付いてます。

# csharp
Mono C# Shell, type "help;" for help

Enter statements below.
csharp> help
"Static methods:
  Describe (object);       - Describes the object's type
  LoadPackage (package);   - Loads the given Package (like -pkg:FILE)
  LoadAssembly (assembly); - Loads the given assembly (like -r:ASSEMBLY)
  ShowVars ();             - Shows defined local variables.
  ShowUsing ();            - Show active using declarations.
  Prompt                   - The prompt used by the C# shell
  ContinuationPrompt       - The prompt for partial input
  Time (() => { });        - Times the specified code
  print (obj);             - Shorthand for Console.WriteLine
  quit;                    - You'll never believe it - this quits the repl!
  help;                    - This help text
  TabAtStartCompletes      - Whether tab will complete even on empty lines
"
csharp> a=12
(1,2): error CS0103: The name `a' does not exist in the current context
csharp> int a=12;
csharp> print(a);
12
csharp> print(a)
12
csharp> print a
(1,2): error CS0118: `Mono.CSharp.InteractiveBase.print(object)' is a `method' but a `type' was expected
csharp> time
(1,2): error CS0103: The name `time' does not exist in the current context
csharp> ShowVars()
int a = 12
csharp> ShowUsing()
using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections;
csharp> class Test {
      > public Main(){
      > Console.WriteLine("ok");
      > }
      > }
(2,8): error CS1520: Class, struct, or interface method must have a return type
csharp> class Test {
      > public void Main(){
      > Console.WriteLine("ok");
      > }
      > }
csharp> var t = new Test{};
csharp> t.Main();
ok
csharp>                                                                                                                 

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?