-
-
Notifications
You must be signed in to change notification settings - Fork 222
Conversation
jmelosegui
commented
Nov 26, 2015
- Complying with the conventions for helper methods
- Added new helper method
throw new Win32Exception(); | ||
} | ||
|
||
int bufferSize = buffer.ToInt32(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's named bufferSize
but it look like it's used as a current possition in the buffer
|
||
if (lpServiceName.Trim() == string.Empty) | ||
{ | ||
throw new ArgumentException(nameof(lpServiceName)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The single argument form of ArgumentException
is taking a description (Where for ArgumentNullException
it's a parameter name) :
throw new ArgumentException("Service name must not be empty", nameof(lpServiceName));
{ | ||
if (string.IsNullOrWhiteSpace(lpServiceName)) | ||
{ | ||
throw new ArgumentNullException(nameof(lpServiceName)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're throwing not just in the null case but in the whitespace case. I suggest throwing ArgumentException then, which is less precise, to match the more general test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll go ahead and merge since you've done a lot of good work here and this is a net positive. But please consider following up with another short change here.
Thanks, @jmelosegui. see inline comment, although I'll merge now. |
Fix and add helper methods to AdvApi