Blue Sky! 2020. 6. 1. 14:46

C# 8.0 ์—์„œ ๋ฐ”๋€์ 

1. Defalut Interface ๊ฐ€ ์ƒ๊น€

interface Test
{

  void DefalutFunc()
  {

   ..... 

  }
}

 

2. Using ๊ฐœ์„ 

using ๋ธ”๋Ÿญ ์‚ฌ์šฉ์„ ๊ฐœ์„ ํ•˜์—ฌ ์•„๋ž˜์™€ ๊ฐ™์ด ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•˜๋‹ค

public static void Test 
{

	using FileSystem test = new FileSystem("text.txt",FileMode.CreateNew);

} // test Dispose

 

3. Nullable Reference

#nullable enable  :  ์ฐธ์กฐ ํƒ€์ž… ๋ณ€์ˆ˜๋ฅผ null ์„ ๋Œ€์ž…ํ•˜๋ฉด ๊ฒฝ๊ณ ๋ฅผ ๋ฐœ์ƒ์‹œํ‚จ๋‹ค.  (#nullable disable : ์‚ฌ์šฉ์•ˆํ•จ)

 

4. Null ๋ณ‘ํ•ฉ ํ• ๋‹น์ž

c# 6.0 null ๋ณ‘ํ•ฉ ์—ฐ์‚ฐ์ž

string s2 = s1 ?? "hello";

-> s1์ด null ์•„๋‹ˆ๋ฉด s1 ๋Œ€์ž…, null ์ด๋ฉด hello ๋ฆฌํ„ด 

c# 8.0 null ๋ณ‘ํ•ฉ ๋Œ€์ž…

s1 ??= "world" ;

-> if ( s1 == null ) s1 ="world";