LoginSignup
2
2

More than 5 years have passed since last update.

C#の基礎的知識

Last updated at Posted at 2018-04-25

授業でした内容を自分のメモとして書き残します。
C言語との比較を交えて、C#言語の基本知識を書きます。


C#の基本形

1. using

〇プログラム内で利用する「名前空間」を宣言するもの
⇒ クラスをまとめて入れておくフォルダ のようなもの
※ クラス …… プログラムの一番小さなかたまり

ポイント
" このフォルダ(名前空間)の中にあるクラスを使います " と宣言するための using 記述である

●Cとの比較①

c#
using System;
using System.Collections.Generic;
c
#include <stdio.h>

2. namespace

C#では " 自分で作るプログラム = クラス " である
⇒クラスであるなら、どこかの名前空間内に置かないといけない

ポイント
それを定義するための namespace 記述
namespaceの名前は変更可

●Cとの比較②

・ Cには " namespace " のような記述は無い
・ C#独自のものである

3. class

ポイント
プログラムの小さなかたまり
classの名前は変更可

・ クラス名 …… メソッド名、関数名

int main(){};

・ main(){}; の {} の中にプログラムを書く
※ 下記はその例である

●Cとの比較③

c#
Console.WriteLine("test");
Console.ReadKey();
c
printf("test¥n");
puts("abc¥n");

最後までお読みいただきありがとうございました。

2
2
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
2
2