Skip to content

Instantly share code, notes, and snippets.

@LeeDDHH
Last active March 27, 2022 23:10
Show Gist options
  • Save LeeDDHH/b283a6467b77fe3aff1a4347dc18d1bf to your computer and use it in GitHub Desktop.
Save LeeDDHH/b283a6467b77fe3aff1a4347dc18d1bf to your computer and use it in GitHub Desktop.
VSCodeでC#を扱うときに使っているスニペット
{
  "add main method": {
    "prefix": "mainmethod",
    "body": [
      "static void Main(string[] args)",
      "{",
      "    $1",
      "}",
    ],
    "description": "Mainメソッドを入れる"
  },
  "init main": {
    "prefix": "initmain",
    "body": [
      "namespace ${TM_DIRECTORY/^.+\\/(.*)$/$1/}",
      "{",
      "    class $TM_FILENAME_BASE",
      "    {",
      "        static void Main(string[] args)",
      "        {",
      "        }",
      "    }",
      "}"
    ],
    "description": "Mainメソッドを初期化する"
  },
  "init class": {
    "prefix": "initcls",
    "body": [
      "namespace ${TM_DIRECTORY/^.+\\/(.*)$/$1/}",
      "{",
      "    class $TM_FILENAME_BASE",
      "    {",
      "    }",
      "}"
    ],
    "description": "クラスを初期化する"
  },
  "init interface": {
    "prefix": "initinterface",
    "body": [
      "namespace ${TM_DIRECTORY/^.+\\/(.*)$/$1/}",
      "{",
      "    interface $TM_FILENAME_BASE",
      "    {",
      "    }",
      "}"
    ],
    "description": "インターフェースを初期化する"
  },
  "static void": {
    "prefix": "sv",
    "body": [
      "static void $1()",
      "{",
      "    ",
      "}"
    ],
    "description": "静的メソッドを生成する"
  },
  "public void": {
    "prefix": "pv",
    "body": [
      "public void $1()",
      "{",
      "    ",
      "}"
    ],
    "description": "インスタンスメソッドを生成する"
  },
  "add readline": {
    "prefix": "cr",
    "body": [
      "Console.ReadLine()"
    ],
    "description": "Console.ReadLineを入れる"
  },
  "add write": {
    "prefix": "cw",
    "body": [
      "Console.Write($\"$1\");"
    ],
    "description": "Console.Writeを入れる"
  },
  "add writeline": {
    "prefix": "cwl",
    "body": [
      "Console.WriteLine($\"$1\");"
    ],
    "description": "Console.WriteLineを入れる"
  }
}

参考

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment