Do not comment what is obvious as
or
It might be a good idea to explain why a particular line of code exists. For example, explain why
panel1.Invalidate();
Must be invalidated.
The main idea: add additional information with comments and use them for explanation, do not create redundancy and duplication.
EDIT:
You can also explain why each item in the toolbar needs to be disabled here:
private void toolStripButton1_Click(object sender, EventArgs e) { foreach (ToolStripButton btn in toolStrip1.Items) { btn.Checked = false; } ... }
because itβs not obvious from the name of the event handler the button is pressed to understand why all the buttons are not checked.
A good comment would be something like:
private void toolStripButton1_Click(object sender, EventArgs e) {
Victor Hurdugaci
source share