2017년 3월 29일 수요일

C# 코딩의 기술 기본편 : 똑똑하게 코딩하는 법
가와마타 아키라 저/김완섭 역 | 길벗

http://m.yes24.com/Goods/Detail/20312268

C#을 쓰기 시작해서 책들을 찾아서 보고 있음.
좀 간단하게 볼만 한 책 중에서는 이 책이 있었음.

두권으로 구성되어 있고 그 중 실전편은 난 별로였으나 기본편은 C# 초보자에게는 간단하게 읽어 볼만 한 것 같다.

저자가 일본 사람이라서 그런지 꼼꼼하게 챕터가 정해진 것 같고 사소하지만 놓치기 쉬운 부분도 함께 정리한 듯 하다. 하지만 책이 대화로 구성되어서 난 보기 쉽지 않더라..

챕터 중 몰랐거나 볼만한 것들은 다음과 같고 나중을 위해 정리해둠.


1.6 루프할 필요가 없는 루프
1.8 해제되지 않는 참조
1.9 해제했다고 생각한 메모리
1.18 using문을 사용하지 않는 증후군

2.1 구세대 컬렉션 사용
2.9 XElement를 Nullable〈T〉로 변환할 수 있을 때
2.13 자바여 편히 잠들라

3.1 GAC에 얽힌 오해
3.2 Ngen 의존 증후군

2017년 3월 27일 월요일

[Link] Xamarin MessagingCenter, publish/subscribe 기반으로 coupling 간단한 message 전달 방법

View model과 다른 component간에 message를 사용하여 연동될 수 있도록 하는 방법이고 message에 대해서 subscribe, publish 하여 사용하므로 coupling을 줄일 수 있다.


: https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/messaging-center/
 

Simple String Message

The simplest message contains just a string in the message parameter. A Subscribe method that listens for a simple string message is shown below - notice the generic type specifying the sender is expected to be of type MainPage. Any classes in the solution can subscribe to the message using this syntax:
MessagingCenter.Subscribe<MainPage> (this, "Hi", (sender) => {
    // do something whenever the "Hi" message is sent
});
In the MainPage class the following code sends the message. The this parameter is an instance of MainPage.
MessagingCenter.Send<MainPage> (this, "Hi");
The string doesn't change - it indicates the message type and is used for determining which subscribers to notify. This sort of message is used to indicate that some event occurred, such as "upload completed", where no further information is required.

하지만 뭐든지 남용하는 건 안될 것 같다.
다음은 MessagingCenter를 사용하지 않아도 될 부분들을 정리해 놓은 내용이다.

Misuses Of MessagingCenter
: https://xamarinhelp.com/common-misuse-messagingcenter/

2017년 3월 8일 수요일