public bool testBool { get; set; }

아무런 초기화 없이 바로 testBool 을 호출하면 무슨 value를 반환할까?




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Program
{
    static void Main(string[] args)
    {
        testing MyTesting = new testing();
 
        if (MyTesting.testBool == falseConsole.WriteLine("bool is false");
        if (MyTesting.testBool == trueConsole.WriteLine("bool is true");
        if (MyTesting.testBool == nullConsole.WriteLine("bool is null");
    }
}
 
class testing
{
    public bool testBool { get; set; }
}
 
// output :
// bool is false
cs


'Language > C#' 카테고리의 다른 글

Enum.Parse  (0) 2018.10.27
Upcasting and Downcasting  (0) 2018.10.24
public, private, protected, internal keyword  (0) 2018.10.24
async await 사용시 조심해야 할 점  (0) 2018.10.14
Object Oriented Robot Programming  (0) 2018.10.14
Posted by 나무길 :