Skip to main content
Code Review

Return to Answer

fix typo not => note
Source Link
RobH
  • 17.1k
  • 6
  • 38
  • 73

Just a very small review to get you started - the code looks pretty good at first glance. You have nice small functions that seem to nicely split up the work. I'm also terrible at winforms so I won't try to suggest things around that.

Your extension method ExtendWithEmptySpaces seems to be functionally equivalent to the built in method String.PadRight.

This:

lvInspectedProcess.Columns.Add("Property ");

Would be better as:

lvInspectedProcess.Columns.Add("Property".PadRight(27));

This bit of code jumps out as not being in the same style as the rest of it:

string query = "SELECT ExecutablePath FROM Win32_Process WHERE ProcessId = " + process.Id;

That's for 2 reasons -

  1. Explicit type when the RHS is obvious
  2. string concatenation

I'd prefer it to look like:

var query = $"SELECT ExecutablePath FROM Win32_Process WHERE ProcessId = {process.Id}";

Another very minor notnote is that in English, unlike some languages, the punctuation should immediately follow the last word in the sentence. That means:

MessageBox.Show(@"No process selected !");

Should be:

MessageBox.Show(@"No process selected!");

That said, I would avoid using exclamation marks in messages to users. It suggests that the program is surprised something has happened (which it isn't) but it can also seem intimidating to less technically savvy users.

Just a very small review to get you started - the code looks pretty good at first glance. You have nice small functions that seem to nicely split up the work. I'm also terrible at winforms so I won't try to suggest things around that.

Your extension method ExtendWithEmptySpaces seems to be functionally equivalent to the built in method String.PadRight.

This:

lvInspectedProcess.Columns.Add("Property ");

Would be better as:

lvInspectedProcess.Columns.Add("Property".PadRight(27));

This bit of code jumps out as not being in the same style as the rest of it:

string query = "SELECT ExecutablePath FROM Win32_Process WHERE ProcessId = " + process.Id;

That's for 2 reasons -

  1. Explicit type when the RHS is obvious
  2. string concatenation

I'd prefer it to look like:

var query = $"SELECT ExecutablePath FROM Win32_Process WHERE ProcessId = {process.Id}";

Another very minor not is that in English, unlike some languages, the punctuation should immediately follow the last word in the sentence. That means:

MessageBox.Show(@"No process selected !");

Should be:

MessageBox.Show(@"No process selected!");

That said, I would avoid using exclamation marks in messages to users. It suggests that the program is surprised something has happened (which it isn't) but it can also seem intimidating to less technically savvy users.

Just a very small review to get you started - the code looks pretty good at first glance. You have nice small functions that seem to nicely split up the work. I'm also terrible at winforms so I won't try to suggest things around that.

Your extension method ExtendWithEmptySpaces seems to be functionally equivalent to the built in method String.PadRight.

This:

lvInspectedProcess.Columns.Add("Property ");

Would be better as:

lvInspectedProcess.Columns.Add("Property".PadRight(27));

This bit of code jumps out as not being in the same style as the rest of it:

string query = "SELECT ExecutablePath FROM Win32_Process WHERE ProcessId = " + process.Id;

That's for 2 reasons -

  1. Explicit type when the RHS is obvious
  2. string concatenation

I'd prefer it to look like:

var query = $"SELECT ExecutablePath FROM Win32_Process WHERE ProcessId = {process.Id}";

Another very minor note is that in English, unlike some languages, the punctuation should immediately follow the last word in the sentence. That means:

MessageBox.Show(@"No process selected !");

Should be:

MessageBox.Show(@"No process selected!");

That said, I would avoid using exclamation marks in messages to users. It suggests that the program is surprised something has happened (which it isn't) but it can also seem intimidating to less technically savvy users.

added quote formatting to OP's code
Source Link
t3chb0t
  • 44.6k
  • 9
  • 84
  • 190

Just a very small review to get you started - the code looks pretty good at first glance. You have nice small functions that seem to nicely split up the work. I'm also terrible at winforms so I won't try to suggest things around that.

Your extension method ExtendWithEmptySpaces seems to be functionally equivalent to the built in method String.PadRight.

This:

lvInspectedProcess.Columns.Add("Property ");
lvInspectedProcess.Columns.Add("Property ");

Would be better as:

lvInspectedProcess.Columns.Add("Property".PadRight(27));

This bit of code jumps out as not being in the same style as the rest of it:

string query = "SELECT ExecutablePath FROM Win32_Process WHERE ProcessId = " + process.Id;
string query = "SELECT ExecutablePath FROM Win32_Process WHERE ProcessId = " + process.Id;

That's for 2 reasons -

  1. Explicit type when the RHS is obvious
  2. string concatenation

I'd prefer it to look like:

var query = $"SELECT ExecutablePath FROM Win32_Process WHERE ProcessId = {process.Id}";

Another very minor not is that in English, unlike some languages, the punctuation should immediately follow the last word in the sentence. That means:

MessageBox.Show(@"No process selected !");
MessageBox.Show(@"No process selected !");

Should be:

MessageBox.Show(@"No process selected!");

That said, I would avoid using exclamation marks in messages to users. It suggests that the program is surprised something has happened (which it isn't) but it can also seem intimidating to less technically savvy users.

Just a very small review to get you started - the code looks pretty good at first glance. You have nice small functions that seem to nicely split up the work. I'm also terrible at winforms so I won't try to suggest things around that.

Your extension method ExtendWithEmptySpaces seems to be functionally equivalent to the built in method String.PadRight.

This:

lvInspectedProcess.Columns.Add("Property ");

Would be better as:

lvInspectedProcess.Columns.Add("Property".PadRight(27));

This bit of code jumps out as not being in the same style as the rest of it:

string query = "SELECT ExecutablePath FROM Win32_Process WHERE ProcessId = " + process.Id;

That's for 2 reasons -

  1. Explicit type when the RHS is obvious
  2. string concatenation

I'd prefer it to look like:

var query = $"SELECT ExecutablePath FROM Win32_Process WHERE ProcessId = {process.Id}";

Another very minor not is that in English, unlike some languages, the punctuation should immediately follow the last word in the sentence. That means:

MessageBox.Show(@"No process selected !");

Should be:

MessageBox.Show(@"No process selected!");

That said, I would avoid using exclamation marks in messages to users. It suggests that the program is surprised something has happened (which it isn't) but it can also seem intimidating to less technically savvy users.

Just a very small review to get you started - the code looks pretty good at first glance. You have nice small functions that seem to nicely split up the work. I'm also terrible at winforms so I won't try to suggest things around that.

Your extension method ExtendWithEmptySpaces seems to be functionally equivalent to the built in method String.PadRight.

This:

lvInspectedProcess.Columns.Add("Property ");

Would be better as:

lvInspectedProcess.Columns.Add("Property".PadRight(27));

This bit of code jumps out as not being in the same style as the rest of it:

string query = "SELECT ExecutablePath FROM Win32_Process WHERE ProcessId = " + process.Id;

That's for 2 reasons -

  1. Explicit type when the RHS is obvious
  2. string concatenation

I'd prefer it to look like:

var query = $"SELECT ExecutablePath FROM Win32_Process WHERE ProcessId = {process.Id}";

Another very minor not is that in English, unlike some languages, the punctuation should immediately follow the last word in the sentence. That means:

MessageBox.Show(@"No process selected !");

Should be:

MessageBox.Show(@"No process selected!");

That said, I would avoid using exclamation marks in messages to users. It suggests that the program is surprised something has happened (which it isn't) but it can also seem intimidating to less technically savvy users.

Source Link
RobH
  • 17.1k
  • 6
  • 38
  • 73

Just a very small review to get you started - the code looks pretty good at first glance. You have nice small functions that seem to nicely split up the work. I'm also terrible at winforms so I won't try to suggest things around that.

Your extension method ExtendWithEmptySpaces seems to be functionally equivalent to the built in method String.PadRight.

This:

lvInspectedProcess.Columns.Add("Property ");

Would be better as:

lvInspectedProcess.Columns.Add("Property".PadRight(27));

This bit of code jumps out as not being in the same style as the rest of it:

string query = "SELECT ExecutablePath FROM Win32_Process WHERE ProcessId = " + process.Id;

That's for 2 reasons -

  1. Explicit type when the RHS is obvious
  2. string concatenation

I'd prefer it to look like:

var query = $"SELECT ExecutablePath FROM Win32_Process WHERE ProcessId = {process.Id}";

Another very minor not is that in English, unlike some languages, the punctuation should immediately follow the last word in the sentence. That means:

MessageBox.Show(@"No process selected !");

Should be:

MessageBox.Show(@"No process selected!");

That said, I would avoid using exclamation marks in messages to users. It suggests that the program is surprised something has happened (which it isn't) but it can also seem intimidating to less technically savvy users.

lang-cs

AltStyle によって変換されたページ (->オリジナル) /