49 lines
818 B
C#
49 lines
818 B
C#
// See https://aka.ms/new-console-template for more information
|
|
|
|
//리터널
|
|
/*
|
|
123 // int 리터럴
|
|
12.3 // double 리터럴
|
|
"A" // string 리터럴
|
|
'a' // char 리터럴
|
|
true // bool 리터럴
|
|
*/
|
|
|
|
// Bool
|
|
bool b = true;
|
|
|
|
// Numeric
|
|
short sh = -32768;
|
|
int i = 2147483647;
|
|
long l = 1234L; // L suffix
|
|
float f = 123.45F; // F suffix
|
|
double d1 = 123.45;
|
|
double d2 = 123.45D; // D suffix
|
|
decimal d = 123.45M; // M suffix
|
|
|
|
// Char/String
|
|
char c = 'A';
|
|
string s = "Hello";
|
|
|
|
// DateTime 2011-10-30 12:35
|
|
DateTime dt = new DateTime(2011, 10, 30, 12, 35, 0);
|
|
|
|
//최대 최소
|
|
int iMax = int.MaxValue;
|
|
float fMin = float.MinValue;
|
|
|
|
//null
|
|
string sn;
|
|
sn = null;
|
|
|
|
// Nullable 타입
|
|
int? inl = null;
|
|
inl = 101;
|
|
|
|
bool? bnl = null;
|
|
|
|
//int? 를 int로 할당
|
|
Nullable<int> j = null;
|
|
j = 10;
|
|
int k = j.Value;
|