整数型・浮動小数点型・文字型・日時型 のデータ範囲(最大値・最小値)一覧表
整数型
  
    | C#別名 | 
    .Net型名 | 
    符号 | 
    サイズ | 
    最小値 | 
    最大値 | 
  
  
    | byte | 
    System.Byte | 
    符号なし | 
    8bit(1byte) | 
    0 | 
    255 | 
  
  
    | short | 
    System.Int16 | 
    符号付き | 
    16bit(2byte) | 
    -32,768 | 
    32,767 | 
  
  
    | int | 
    System.Int32 | 
    符号付き | 
    32bit(4byte) | 
    -2,147,483,648 | 
    2,147,483,647 | 
  
  
    | long | 
    System.Int64 | 
    符号付き | 
    64bit(8byte) | 
    -9,223,372,036,854,775,808 | 
    9,223,372,036,854,775,807 | 
  
  
    | sbyte | 
    System.SByte | 
    符号付き | 
    8bit(1byte) | 
    -128 | 
    127 | 
  
  
    | ushort | 
    System.UInt16 | 
    符号なし | 
    16bit(2byte) | 
    0 | 
    65,535 | 
  
  
    | uint | 
    System.UInt32 | 
    符号なし | 
    32bit(4byte) | 
    0 | 
    4,294,967,295 | 
  
  
    | ulong | 
    System.UInt64 | 
    符号なし | 
    64bit(8byte) | 
    0 | 
    18,446,744,073,709,551,615 | 
  
  
    | なし | 
    System.Numerics.BigInteger | 
    符号付き | 
    無制限 | 
    無制限 | 
    無制限 | 
  
System.Numerics.BigInteger を使用するには、「System.Numerics」の参照設定が必要です。
浮動小数点型
  
    | C#別名 | 
    .Net型名 | 
    サイズ | 
    おおよその範囲 | 
    最小値・最大値 | 
  
  
    | float | 
    System.Single | 
    32bit( 4byte) | 
    ±1.5 x 10  −45 から ±3.4    x 1038 | 
    ±3.402823E+38 | 
  
  
    | double | 
    System.Double | 
    64bit( 8byte) | 
    ±5.0 x 10 −324 から ±1.7    x 10308 | 
    ±1.79769313486232E+308 | 
  
  
    | decimal | 
    System.Decimal | 
    128bit(16byte) | 
    ±1.0 x 10  -28 から ±7.9228 x 1028 | 
    ±79,228,162,514,264,337,593,543,950,335 | 
  
文字列
  
    | C#別名 | 
    .Net型名 | 
    最大文字数 | 
  
  
    | string | 
    System.String | 
    2 GB、または約10億文字 | 
  
日時
  
    | C#別名 | 
    .Net型名 | 
    最小値 | 
    最大値 | 
    オフセット範囲 | 
    精度 | 
  
  
    | DateTime | 
    System.DateTime | 
    0001/01/01 0:00:00 | 
    9999/12/31 23:59:59 | 
     | 
    100ナノ秒 | 
  
  
    | DateTimeOffset | 
    System.DateTimeOffset | 
    0001/01/01 0:00:00 +00:00 | 
    9999/12/31 23:59:59 +00:00 | 
    ±14:00 | 
    100ナノ秒 | 
  
  
    | TimeSpan | 
    System.TimeSpan | 
    -10675199.02:48:05.4775808 | 
    10675199.02:48:05.4775807 | 
     | 
    100ナノ秒 | 
  
100ナノ秒単位で時刻を保持できますが、システム日時を取得する際の精度はパソコン・OSに依存します。
プログラム中で最大値と最小値を取得する
型名.MaxValue定数で最大値、型名.MinValue定数で最小値を取得可能です。
C#
byteの最大値 = byte.MaxValue;
byteの最小値 = byte.MinValue;
intの最大値 = int.MaxValue
intの最小値 = int.MinValue
 
VB.NET
byteの最大値 = Byte.MaxValue;
byteの最小値 = Byte.MinValue;
intの最大値 = Integer.MaxValue
intの最小値 = Integer.MinValue
 
検証環境
- 
  Microsoft Visual Studio Professional 2017 Version 15.9.21
 
- 
  Microsoft .NET Framework Version 4.6
 
- 
  Microsoft Windows 10 Pro Version 1909 OS Build 18363.1016