default(Type)
を使う。
struct hogehoge {
string s;
}
struct hoge {
int i;
string s;
hogehoge hh;
}
hoge h = default(hoge);
数値型に対しては 0、 参照型に対しては null。
構造体に対しては、 構造体の全てのメンバーに対して 0 または null で初期化したものを与える。
More than 5 years have passed since last update.
default(Type)
を使う。
struct hogehoge {
string s;
}
struct hoge {
int i;
string s;
hogehoge hh;
}
hoge h = default(hoge);
数値型に対しては 0、 参照型に対しては null。
構造体に対しては、 構造体の全てのメンバーに対して 0 または null で初期化したものを与える。
Register as a new user and use Qiita more conveniently