IsNullOrEmpty (1) 썸네일형 리스트형 [C#] 문자열 04 - IsNullOrEmpty(), IsNullOrWhiteSpace() 문자열 판별하기 반드시 필요한 메서드는 아니지만 string 클래스에서는 비교적 코드를 깔끔하게 작성할 수 있도록 몇 가지 종류의 판별 메서드를 제공한다. 1. bool string.IsNullOrEmpty(string) 지정된 문자열이 null이거나 빈 문자열(길이가 0)인 경우 true를, 그렇지 않은 경우 false를 반환한다. void button_Click( object sender, EventArgs e ) { if ( !string.IsNullOrEmpty( textBox1.Text ) ) { MessageBox.Show( textBox1.Text ); } else { MessageBox.Show( "Empty." ); } } // Decompiled String.cs public static bool Is.. 이전 1 다음