C#のメモ
調べたものをメモする。
カレントディレクトリの取得
using System.IO;
した後、
string cd = Directory.GetCurrentDirectory();
で得られる。
配列(の例)
整数の配列
int[] x = {1,2,3,4,5,6,7,8};
数の変換
//文字列への変換
int num = 10;
string st = num.ToSring();
string st2 = Math.PI.ToSring();
//文字列からの変換
int num2 = int.Parse(st);
//int以外の型の数からintへの変換
int num2 = (int)Math.PI;
画像の扱い
画像はProperiesのリソースに登録
pictureBox1.Image = Properties.Resources.image_name;
// で取得
Color c = Properties.Resources.image_name.GetPixel(0,0);
// で色取得