你遇到过的源代码中最好的注释是什么?


当前回答

我参与的一个大型项目在自动构建中使用了StyleCop和FXCop,并使用规则来防止人们检入带有未注释字段、方法、属性等的代码。

有些人对必须添加“获取或设置全名”之类的注释到自记录属性(如FullName)感到非常恼火,以至于他们不得不努力编写一个宏来绕过这些规则。

宏为方法、属性等插入了XML摘要标记,其中一个单一的不显示Unicode字符作为标记内容,这将欺骗构建规则,同时对为了注释而盲目坚持的东西进行轻微打击……

...至少直到他们引入了另一条规则来检查注释中的Unicode字符。

其他回答

//
//3.4  JeK  My manager promised me a lap dance if I can fix this release
//3.5  JeK  Still waiting for that dance from my manager
//3.6  JeK  My manager got changed, the new manager is hairy, dont want the dance anymore
//3.7  Jek  Got that dance, yuck!
//
catch (Domain.ConcurrencyException)
{
    // somebody changed it between the time we loaded it and now.
    // weird, huh?
}

.class {border:1px solid gold;} /*我可怜这个傻瓜*/

在某些汇编程序中,在包含&h723的行末尾

' RIP LVB

(明白吗?)

我刚刚注意到自己在写这个

// not brilliant solution, but fair enough heh.