4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

C#のデータ型について

Posted at

はじめに

授業で学んだ事のメモとして使います。

データ型

C#のデータ型について

データ型には数値、文字列など様々な種類がある。
VisualC#で使用できるデータ型は[値型]と[参照型]の二種類ある。

値型

変数の値を直接格納する。
値型に属するデータ型には、
sbyte
範囲は-128~127で、符号付き8ビット整数
short
範囲は-32768~32767で、符号付き16ビット整数
int
範囲は-2147483648~2147483647で、符号付き32ビット整数
long
範囲は-9223372036854770000~9223372036854775807で、符号付き64ビット整数
byte
範囲は0~255で、符号なしビット整数
ushort
範囲は0~65535で、符号なし16ビット整数
uint
範囲は0~4294967295で、符号なし32ビット整数
ulong
範囲は0~18446744073709551615で、符号なし64ビット整数
float
浮動小数点型
範囲は±1.5e-45~±3.4e38(おおよその範囲)で、有効桁数7桁
double
浮動小数点型
範囲は±5.0e-324~±1.7e308(おおよその範囲)で、有効桁数15~16桁
bool
true/false(ブール値)
※真か偽の格納のみを目的とした変数の作成にはbool型が適している
char
範囲はU+0000~U+ffffで、Unicode16ビット文字
decimal
範囲は±1.0×10-28~±7.9×1028で、有効桁数28~29桁
の型がある。

参照型

変数が持っているのは参照情報だけで、実体は別の場所に確保される。
参照型には、
object
string
の型がある。

4
3
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
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?