전체 글 (196) 썸네일형 리스트형 C# String IsNullOrEmpty vs IsNullOrWhiteSpace string값 null체크와 더불어 유효하지 않은 값을 함께 검사할 때 (유효의 정의는 목적에 따라 다르겠지만) 자주 사용하는것이 IsNullOrEmpty()와 IsNullOrWhiteSpace() 이다. 두 함수의 비교를 위해 아래 코드를 보자 (두 코드는 결과가 동일한 코드이다.) String.IsNullOrWhiteSpace(sampleString); String.IsNullOrEmpty(sampleString) || value.Trim().Length == 0; IsNullOrWhiteSpace()는 InNullOrEmpty()를 포함하고 추가적으로 공백 문자까지 체크해준다. ref : https://docs.microsoft.com/ko-kr/dotnet/api/system.string.isnu.. C# .NET Custom CultureInfo and satellite assemblies 아래처럼 Custom CultureInfo를 추가해야 하는 경우가 있다. 태국에 영어로 서비스를 지원하고 싶어 리소스파일(resx)을 추가하려 하는데 해당하는 culture info(en-TH)가 기본적으론 없는 경우 culture info를 직접 추가하는 방법은 다음과 같다. var culture = new CultureAndRegionInfoBuilder("en-TH", CultureAndRegionModifiers.None); culture.LoadDataFromCultureInfo(CultureInfo.CreateSpecificCulture("en-US")); culture.LoadDataFromRegionInfo(new RegionInfo("th-TH")); culture.Register(); .. Xamarin missing Android.Graphics namespace not found 런타임에 안드로이드 상단 status bar 색상을 바꿔주기 위해 Android 프로젝트에 DependencyService로 함수를 구현하던 중 Color 클래스의 namespace를 찾지 못하는 문제가 발생했다. 별도의 Nuget Package를 설치해야 하는 문제는 아닌 것 같고 개체 브라우저에서 찾아보니 음..? Mono.Android에 들어있다? 분명 프로젝트 참조에 Mono.Android (기본으로 포함되어있음)가 있다. 뭔가가 있는데 못 찾는다? -> 비슷한 게 더 있어서 헷갈리는구나 -> 그럼 정확히 알려줘야겠다 ref : https://forums.xamarin.com/discussion/150321/the-type-or-namespace-name-android-does-not-exist-.. Please check that your Nuget Package versions are compatible "Please check that your Nuget Package versions are compatible" 에러는 특히나 오픈소스를 가져와 빌드해볼 때 자주 만나는 것 같다. 결론부터 말하면 사용중인 Nuget Package중의 일부가 호환되지 않아 생기는 문제이다. Nuget Package 관리창을 보면 아래와 같이 종속성 정보를 볼 수 있다. 이번엔 패키지들끼리의 종속성 문제가 아닌 패키지와 해당 안드로이드 프로젝트의 Version정보 사이의 문제였다. 사용 중인 패키지중 하나가 Android 6.0 이상 조건이 있어 최소 Android Version을 5.0 -> 6.0으로 바꿔준 뒤 빌드하여 해결했다. ref : https://forums.xamarin.com/discussion/128406.. .NET CurrentCulture vs CurrentUICulture 현재 Thread에서 문화권 정보를 설정하거나 CultureInfo 객체로부터 문화권 정보를 가져오려고 하다 보면 헷갈리는 두 가지가 있다. CurrentCulture와 CurrentUICulture이다. CurrentCulture는 숫자 및 날짜 형식 등을 제어하고 CurrentUICulture는 인터페이스 언어를 나타낸다(Localization과 관련이 있다.) 아래와 같이 설정한 스레드에서 돌아가는 프로그램을 생각해보자 Thread.CurrentThread.CurrentCulture = new CultureInfo("ko-KR"); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); 해당 프로그램에서 돈을 표시할 일이 있다면 Curren.. LINQ Aggregate namespace : System.Linq definition : public static TSource Aggregate(this IEnumerable source, Func func) description : 시퀸스에 누적기 함수를 적용한다. usage summary : 비슷한 느낌의 연산자로 "+=" 이 있다 Ienumerable.Aggregate((result, item) => result + ", " + item); example : string sample = "나는 이 문장의 단어 배열을 뒤집을 것이다"; var words = stringSample.Split(' '); var reversedSample = words.Aggregate((result, word) => word + " " + .. 이전 1 ··· 14 15 16 17 18 19 20 ··· 33 다음