2015-10-19 40 views
0

我試圖找到一種方式來定製的代碼錯誤添加到Visual Studio添加自定義編譯錯誤,在Visual Studio中

例如

我想,以防止對字符串使用==操作的參數 和執行使用字符串的equals方法,而不是

所以,如果一個程序員會寫下面的代碼

string myString = .... 

if(myString == "the string") - this line will have a compilation error 

有什麼想法?

+0

定製羅斯林代碼分析器_probably_可能會有幫助,但它不是一項容易的任務來實現:https://開頭msdn.microsoft.com/en-us/magazine/dn879356.aspx –

回答