Null조건 연산자(?)


Null조건 연산자(?)

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp3 { class Program { static void Main(string[] args) { string s = null; if (s!=null&&s.Length>1) { Console.WriteLine("사랑해"); } else { Console.WriteLine("싫어해"); } if (s?.Length>1) { Console.WriteLine("사랑해"); } else { Console.WriteLine("싫어해"); } } } } s != null && ..


원문링크 : Null조건 연산자(?)