Skip to main content
← Back to course

Quick Actions and the Light Bulb

The single most underused feature in Visual Studio for new users is a small light bulb icon that appears right in your code — it's Visual Studio actively telling you it has a suggestion.

The light bulb (or screwdriver icon) appears when Visual Studio has something to offer — a fix, a refactoring, or a code-generation option — at your cursor's current position. Press Ctrl+. (period) to open its menu without reaching for the mouse.

Common Quick Actions you'll see constantly:

  • Generate constructor — click on a class with fields but no constructor, and Quick Actions offers to generate one that assigns them.
  • Add missing usings — reference a type from a namespace you haven't imported yet, and the light bulb offers to add the using statement for you.
  • Introduce a variable / inline a variable — turn a repeated expression into a named variable, or collapse a single-use variable back into its expression.
  • Implement interface members — implement a class against an interface, and Quick Actions can generate stub methods for every member you haven't written yet.
  • Suppress or fix a warning — for code analysis warnings (squiggly underlines), the light bulb often offers the actual fix, not just a description of the problem.

The screwdriver icon (vs. the light bulb) specifically means refactoring options — Visual Studio distinguishes "fix a problem" (light bulb) from "restructure working code" (screwdriver), though both open via the same Ctrl+. shortcut.

Why this matters for you

Once you build the habit of glancing at the light bulb instead of typing boilerplate by hand, a genuine amount of routine code — constructors, using statements, interface stubs — stops being something you write at all.

▶️ Before the next lesson

Open any class in your project and add a field without a constructor. Click on the class name and press Ctrl+. to see if "Generate constructor" appears — that's the light bulb in action.