들여쓰기를 TAB 을 사용하는 것 까지는 공감하나, TAB 사이즈의 크기는 프로젝트를 진행하기전에 공통된 룰을 설정 하는게 좋다.
Github 의 Gist 의 경우는 TAB 사이즈가 2로 기본 초기화 되어있다. 또 한, 많은 오픈소스들이 2 또는 4로 TAB 사이즈로 되어 있다.
/* | |
* @brief : 나쁜예 예시 | |
*/ | |
public void HelloWord() { | |
// Format a message and display - 주석이 밀려있다. | |
string fullMessage = "Hello " + name; | |
DateTime currentTime = DateTime.Now; | |
string message = fullMessage + ", the time is : " + currentTime.ToShortTimeString(); | |
MessageBox.Show ( message ); | |
} |
/* | |
* @brief : 좋은 예 예시 | |
*/ | |
public void HelloWord() { | |
// Format a message and display - 주석와 코드 레벨이 같다 | |
string fullMessage = "Hello " + name; | |
DateTime currentTime = DateTime.Now; | |
string message = fullMessage + ", the time is : " + currentTime.ToShortTimeString(); | |
MessageBox.Show ( message ); | |
} |
/* | |
* @brief : 좋은 예 예시 | |
* @mantis : 19991 | |
* @date : 2017.12.31 | |
*/ | |
public void HelloWord() { | |
// [2017.12.31][MID][19991] : Todo.. | |
string fullMessage = "Hello " + name; | |
DateTime currentTime = DateTime.Now; | |
string message = fullMessage + ", the time is : " + currentTime.ToShortTimeString(); | |
MessageBox.Show ( message ); | |
} |
public void Foo() | |
{ | |
// ToDo.. | |
} |
public void Foo() { | |
// ToDo.. | |
} |
public void compare(int lhs, int rhs){ | |
// 앞, 뒤로 공간을 남기지 않은 예 | |
if(lhs==rhs){ | |
return true; | |
} | |
return true; | |
} | |
public void compare(int lhs, int rhs) | |
{ | |
// 앞, 뒤로 공간을 남긴 예 | |
if (lhs == rhs) | |
{ | |
return true; | |
} | |
return false; | |
} |
ASP.NET - 웹 켄버스(Silver Light) (0) | 2018.01.02 |
---|---|
ASP.NET - ADO.NET + ASP.NET DB 연동 간단한 예제 (0) | 2018.01.02 |
C# - error CS0227: Unsafe code (0) | 2017.12.30 |
C# - 크로스 스레드 작업이 잘못 되었습니다. (0) | 2017.12.30 |
C# - 읽기 전용 디렉토리 삭제하기 (0) | 2017.12.30 |
댓글 영역