Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

When Resharper argues with itself, how does one know which persona to give more credence?

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.).

With this line of code:

ICryptoTransform Encryptor = RijndaelCipher.CreateEncryptor(SecretKey.GetBytes(32), SecretKey.GetBytes(16));

Resharper tells me to "add argument name 'rgbkey'" and then "add argument name 'rgbIV'"

So that the line is then:

ICryptoTransform Encryptor = RijndaelCipher.CreateEncryptor(rgbKey: SecretKey.GetBytes(32), rgbIV: SecretKey.GetBytes(16));

When I run Resharper again, though, it says,

"Redundant argument name specification" - "Remove argument name specification" (rgbkey) (and then rgbIV).

It seems either way works fine, though...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
180 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...