전체 글 88

C#: Read and Write Excel (*.xls and *.xlsx) Files Content without Excel Automation using ADO.NET

OleDB Connection 을 이용하여 간단하게 엑셀 파일을 Read/Write 를 할 수 있는 방법을 찾음. SqlDataAdapter로 DataSet을 채운 뒤 사용. 버전에 따라 ConnectionString이 다름, 이 점만 주의하면 됨. -------------------------------------------------------------------------------------------- Fetch the records from excel file using C# .Net, Asp.Net - Step 1 - Let's create an interface which will contain two buttons for Refresh data from .xls and Refresh d..

프로그래밍/C# 2015.08.24

C# String Array 에서 Item 삭제(remove) 하기

String Array 의 경우 List 와 달리 아이템 삭제하기가 편하지 않음. 아래와 같이 LINQ 를 사용해 주면 쉽게 삭제 가능함. nArrayCount 를 삭제하려는 Index로 지정. -------------------------------------------------------------------------- String [] aRowData = ~~~~~~~~ aRowData = aRowData.Where(condition => condition != aRowData[nArrayCount]).ToArray(); --------------------------------------------------------------------------

프로그래밍/C# 2014.08.27

C# 두개의 List에 대해 중복 제거(Distinct)

두개의 List를 간단하게 중복 제거 하는 방법 ------------------------------------------------ // 중복 제거 List lDownloadList_v1 = new List(); List lDownloadList_v2 = new List(); lDownloadList_v1.Concat(lDownloadList_v2).Distinct(); -> 잘 안되는것같음(X) lDownloadList_v1 = lDownloadList_v1 .Except(lDownloadList_v2 ).ToList(); -> 아주 잘 됨(O)------------------------------------------------

프로그래밍/C# 2014.08.05

C# Country code (2자리) 인지 체크 하는 방법

아래와 같이 country code 2자리를 넣어주면 정상일경우 국가 정보에 대해 나오며 없는 country code 일 경우 예외로 빠짐. --------------------------------------------------------------------------------------------------- String countryCode = "DK"; try { System.Globalization.RegionInfo info = new System.Globalization.RegionInfo(countryCode); } catch (System.Exception ex) { // 국가 코드 아님 } ---------------------------------------------------..

프로그래밍/C# 2014.05.29