예제 #1
0
        static void Main(string[] args)
        {
            GenericTest <int> t = new GenericTest <int>();

            Console.WriteLine(t.GetDefaultValue());

            int        intValue    = default;
            BigInteger bigIntValue = default;

            Console.WriteLine(intValue);        // 출력 결과: 0
            Console.WriteLine(bigIntValue);     // 출력 결과: 0

            string txt = default;

            Console.WriteLine(txt ?? "(null)"); // 출력 결과: (null)
        }
예제 #2
0
파일: Program.cs 프로젝트: haeinmin/CSharp8
        static void Main(string[] args)
        {
            int        intValue    = default;   //int로 대입된다는 것을 알 수 있으므로
            BigInteger bigIntValue = default;   //BigInteger로 대입되므로

            Console.WriteLine(intValue);        // 출력 결과: 0
            Console.WriteLine(bigIntValue);     // 출력 결과: 0

            string txt = default;               //string 타입의 기본값을 반환

            Console.WriteLine(txt ?? "(null)"); // 출력 결과: (null)

            GenericTest <int> t = new GenericTest <int>();

            Console.WriteLine(t.GetDefaultValue()); //출력 결과: 0
        }