(C#) String.Empty와 ""의 차이점 String sTest = String.Empty; String sTest = ""; 위 두 개는 정확히 동일한 구문이다. String.Empty는 코드의 가독성을 위해서 사용한다.[""라고 쓰면 뭔가 없어(?) 보이므로] String.Empty와 ""는 정확히 동일하다고 보면 된다! 더보기 C# 초간단 WebRequest 예제 초간단 WebRequest 예제를 소개한다! GET 방식으로 url을 호출한 후 response를 받아오는 예제이다! 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 using System; using System.Net; using System.IO; class Test { static void Main(string[] args) { WebRequest request = WebRequest.Create("http://www.test.com/test1.jsp?id=test"); // 호출할 url request.Method = "GET"; WebResponse response = request.GetResponse(); Stream data.. 더보기 C# 구분자 기준으로 문자열 자르는 방법(Split 이용) C#에서 문자열을 자르는 방법은 간단하다. Split()을 사용하면 된다! 예제 소스는 다음과 같다. using System; class Test { static void Main(string[] args) { string s = "aaa#bbb#ccc#ddd"; string[] words = s.Split('#'); // # 기준으로 자른다. foreach(string word in words) // 자른 결과물 순서대로 출력 { Console.WriteLine(word); } } } 더보기 이전 1 2 3 다음