問題描述
當 Resharper 與自己爭論時,人們如何知道更信任哪個角色?
When Resharper argues with itself, how does one know which persona to give more credence?
我想我發現了一些確實讓 Resharper 感到困惑的代碼(這顯然是一個非常不尋常的案例 - 在使用了一天之后,我認為 Resharper 是蜜蜂的膝蓋/自液化面包等以來最偉大的東西).
I think I have found some code that does confuse Resharper (this is apparently a very unusual case - after using it for a day, I think Resharper is the bee's knees/the greatest thing since liquified bread, etc.).
有了這行代碼:
ICryptoTransform Encryptor = RijndaelCipher.CreateEncryptor(SecretKey.GetBytes(32), SecretKey.GetBytes(16));
Resharper 告訴我添加參數名稱'rgbkey'" 然后添加參數名稱'rgbIV'"
Resharper tells me to "add argument name 'rgbkey'" and then "add argument name 'rgbIV'"
所以這條線是:
ICryptoTransform Encryptor = RijndaelCipher.CreateEncryptor(rgbKey: SecretKey.GetBytes(32), rgbIV: SecretKey.GetBytes(16));
不過,當我再次運行 Resharper 時,它會說,
When I run Resharper again, though, it says,
冗余參數名稱規范"-刪除參數名稱規范"(rgbkey)(然后是 rgbIV).
"Redundant argument name specification" - "Remove argument name specification" (rgbkey) (and then rgbIV).
不過,似乎任何一種方式都可以正常工作......
It seems either way works fine, though...
推薦答案
顯式參數命名在強制參數上是可選的,所以這兩種形式都是正確的",問題是你更喜歡哪個?正如 vcsjones 所說,Resharper 只是為您提供一些重構選項以滿足您的偏好.
Explicit parameter naming is optional on mandatory parameters, so both forms are "correct," the question is which do you like better? Like vcsjones said, Resharper is just giving you some refactoring options to suit your preferences.
這篇關于應該添加還是刪除這些論點?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!