Table of Contents
Using the Visual Studio Development Environment for C#
 How to: Add an Application Configuration File to a C# Project
 Metadata as Source
 Refactoring
   Change Method Signature
   Encapsulate Field
   Extract Interface
   Extract Method
   Inline Temporary Variable
   Move Type to Matching File
   Rename
   Sync Type and Filename
 Code Generation
   Generate Class/Type
   Generate Method
   Generate Field/Property/Local
   Generate Constructor
   Generate Override
   Generate XML Documentation Comments
   Implement Abstract Class
   Implement Interface
   Introduce Local Variable
         Using the Visual Studio Development Environment
         for C#
         10/31/2017 • 2 min to read • Edit Online
The Visual Studio integrated development environment (IDE) is a collection of development tools exposed through
a common user interface. Some of the tools are shared with other Visual Studio languages, and some, such as the
C# compiler, are unique to Visual C#. This topic provides links to the most important Visual C# tools.
Related Topics
 TITLE                                                           DESCRIPTION
 Walkthrough: Create a Simple Application                        Provides an overview of many of the features and tools
                                                                 included in Visual Studio for application development.
 Creating Solutions and Projects                                 Describes how to create a project that contains all the source
                                                                 code files, resource files such as icons, references to external
                                                                 files, and configuration data such as compiler settings.
 Writing Code                                                    Describes Visual Studio tools that help you modify and
                                                                 manipulate text, code, and markup, insert and configure
                                                                 controls and other objects and namespaces, and add
                                                                 references to external components and resources.
 Visual C# IntelliSense                                          Provides links to topics that describe Visual C#-specific
                                                                 features, such as automatic code generation and IntelliSense
                                                                 for most recently used members.
 Visual C# Code Snippets                                         Provides an overview of using Code Snippets in Visual C# to
                                                                 automatically add common code constructs to your
                                                                 application
 Writing Code                                                    Provides links to procedures about how to use the Find and
                                                                 Replace window, Bookmarks, and the Task List and Error List
                                                                 to locate lines of code.
 Viewing the Structure of Code                                   Explains how to browse hierarchies of classes, class members,
                                                                 and resources.
 How to: Add an Application Configuration File to a C# Project   Describes how to add a configuration file (app.config) to a C#
                                                                 project.
 Metadata as Source                                              Describes how the IDE enables you to view metadata as
                                                                 source code.
 Refactoring (C#)                                                Lists refactoring operations that help you modify your code
                                                                 without changing the behavior of your application.
 Code Generation (C#)                                            Lists code generation tools that will write portions of code for
                                                                 you.
 TITLE                                   DESCRIPTION
 Compiling and Building                  Explains how to configure debug, release, and special builds of
                                         your Visual Studio solution.
 Debugging in Visual Studio              Describes how to run the Visual Studio Debugger to resolve
                                         logic and semantic errors.
 Managing Application Resources (.NET)   Shows how to add or edit resources for your project, such as
                                         strings, images, icons, audio, and files.
 Dotfuscator Community Edition (CE)      Explains how to set up and start using the free PreEmptive
                                         Protection - Dotfuscator Community Edition to protect .NET
                                         assemblies from reverse-engineering and unauthorized use
                                         (such as unauthorized debugging).
See Also
C#
Getting Started with C#
C# Reference
       How to: Add an Application Configuration File to a
       C# Project
       10/31/2017 • 1 min to read • Edit Online
By adding an application configuration file (app.config file) to a C# project, you can customize how the common
language runtime locates and loads assembly files. For more information about application configuration files, see
How the Runtime Locates Assemblies.
  NOTE
  UWP apps don't contain an app.config template.
When you build your project, the development environment automatically copies your app.config file, changes the
file name of the copy to match your executable, and then moves the copy to the bin directory.
To add an application configuration file to your C# project
1. On the menu bar, choose Project, Add New Item.
   The Add New Item dialog box appears.
2. Expand Installed, expand Visual C# Items, and then choose the Application Configuration File template.
3. In the Name text box, enter a name, and then choose the Add button.
   A file that's named app.config is added to your project.
See Also
Managing Application Settings (.NET)
Configuration File Schema
Configuring Apps
How to: Configure an App to Target a .NET Framework Version
Using the Visual Studio Development Environment for C#
       Metadata as Source
       10/31/2017 • 1 min to read • Edit Online
Metadata as source enables you to view metadata that appears as C# source code in a read-only buffer. This
enables a view of the declarations of the types and members (without implementations). You can view metadata as
source by running the Go To Definition command for types or members whose source code is not available from
your project or solution.
  NOTE
  When you try to run the Go To Definition command for types or members that are marked as internal, the integrated
  development environment (IDE) does not display their metadata as source, regardless of whether the referencing assembly is
  a friend or not.
You can view metadata as source in either the Code Editor or the Code Definition window.
Viewing Metadata as Source in the Code Editor
When you run the Go To Definition command for an item whose source code is unavailable, a tabbed document
that contains a view of that item's metadata, displayed as source, appears in the Code Editor. The name of the type,
followed by [from metadata], appears on the document's tab.
For example, if you run the Go To Definition command for Console, metadata for Console appears in the Code
Editor as C# source code that resembles its declaration, but without an implementation.
Viewing Metadata as Source in the Code Definition Window
When the Code Definition window is active or visible, the IDE automatically executes the Go To Definition
command for items under the cursor in the Code Editor and for items that are selected in Class View or the Object
Browser. If the source code is not available for that item, the IDE displays the item's metadata as source in the
Code Definition window.
For example, if you put your cursor inside the word Console in the Code Editor, metadata for Console appears as
source in the Code Definition window. The source resembles the Console declaration, but without an
implementation.
If you want to see the declaration of an item that appears in the Code Definition window, right-click the item and
click Go To Definition.
       Refactoring features for C#
       10/31/2017 • 1 min to read • Edit Online
Refactoring is the process of improving your code after it has been written by changing the internal structure of
the code without changing the external behavior of the code. The following refactoring features are available in
Visual Studio for C#:
   Change Method Signature
   Encapsulate Field
   Extract Interface
   Extract Method
   Inline Temporary Variable
   Move Type to Matching File
   Rename
   Sync Type and Filename
See Also
Using the Visual Studio Development Environment for C#
       Change a method signature in C#
       10/31/2017 • 1 min to read • Edit Online
What: Lets you remove or change the order of a method's parameters.
When: You want to move or remove a method parameter that is currently being used in a variety of locations.
Why: You could manually remove and re-order the parameters, and then find all calls to that method and change
them one-by-one, but that could lead to errors. This refactoring tool will perform the task automatically.
How:
1. Highlight or place the text cursor inside the name of the method to modify, or one of its usages:
2. Next, do one of the following:
       Keyboard
          Press Ctrl+R, then Ctrl+V. (Note that your keyboard shortcut may be different based on which
          profile you've selected.)
          Press Ctrl+. to trigger the Quick Actions and Refactorings menu and select Change Signature
          from the Preview window popup.
       Mouse
          Select Edit > Refactor > Remove Parameters.
          Select Edit > Refactor > Reorder Parameters.
          Right-click the code, select the Quick Actions and Refactorings menu and select Change
          Signature from the Preview window popup.
3. In the Change Signature dialog that pops up, you can use the buttons on the right side to change the
   method signature:
    BUTTON                                                       DESCRIPTION
    Up/Down                                                      Move the selected parameter up and down the list
    Remove                                                       Remove the selected parameter from the list
    Restore                                                      Restore the selected, crossed-out parameter to the list
     TIP
     Use the Preview reference changes checkbox to see what the result will be before committing to it.
4. When you are finished, press the OK button to make the changes.
See Also
Refactoring (C#)
Preview Changes
       Encapsulate a field in C#
       10/31/2017 • 1 min to read • Edit Online
What: Lets you turn a field into a property, and update all usages of that field to use the newly created property.
When: You want to move a field into a property, and update all references to that field.
Why: You want to give other classes access to a field, but don't want those classes to have direct access. By
wrapping the field in a property, you could write code to verify the value being assigned, for example.
How:
1. Highlight or place the text cursor inside the name of the field to encapsulate:
2. Next, do one of the following:
       Keyboard
         Press Ctrl+R, then Ctrl+E. (Note that your keyboard shortcut may be different based on which
         profile you've selected.)
         Press Ctrl+. to trigger the Quick Actions and Refactorings menu and select either Encapsulate
         field entry from the Preview window popup.
       Mouse
         Select Edit > Refactor > Encapsulate Field.
         Right-click the code, select the Quick Actions and Refactorings menu and select either
         Encapsulate field entry from the Preview window popup.
     SELECTION                                                    DESCRIPTION
     Encapsulate field (and use property)                         Encapsulates the field with a property, and updates all
                                                                  usages of the field to use the generated property
     Encapsulate field (but still use field)                      Encapsulates the field with a property, but leaves all
                                                                  usages of the field untouched
   The property will be immediately created and references to the field will be updated, if selected.
     TIP
     Use the Preview changes link in the popup window to see what the result will be before committing to it.
See Also
Refactoring (C#)
Preview Changes
       Extract an interface in C#
       10/31/2017 • 1 min to read • Edit Online
What: Lets you create an interface using existing members from a class, struct or interface.
When: You have several classes, structs or interfaces with methods that could be made common and used by
other classes, structs or interfaces.
Why: Interfaces are great constructs for object-oriented designs. Imagine having classes for various animals (Dog,
Cat, Bird) which might all have common methods, such as Eat, Drink, Sleep. Using an interface like IAnimal would
allow Dog, Cat, and Bird to have a common "signature" for these methods.
How:
1. Highlight the name of the class to perform the action on, or just put the text cursor somewhere in the class
   name.
2. Next, do one of the following:
       Keyboard
          Press Ctrl+R, then Ctrl+I. (Note that your keyboard shortcut may be different based on which
          profile you've selected.)
          Press Ctrl+. to trigger the Quick Actions and Refactorings menu and select Extract Interface
          from the Preview window popup.
       Mouse
          Select Edit > Refactor > Extract Interface.
          Right-click the name of the class, select the Quick Actions and Refactorings menu and select
          Extract Interface from the Preview window popup.
3. In the Extract Interface dialog box that pops up, enter the information asked:
     FIELD                                                     DESCRIPTION
     New interface name                                        The name of the interface to be created. This will default to
                                                               IClassName, where ClassName is the name of the class
                                                               you selected above.
     New file name                                             The name of the file which will be generated that will
                                                               contain the interface. As with the interface name, this will
                                                               default to IClassName, where ClassName is the name of
                                                               the class you selected above.
     Select public members to form interface                   The items to extract into the interface. You may select as
                                                               many as you wish.
4. Click OK.
   The interface will be immediately created in the file of the name specified. Additionally, the class you
   selected will now implement that interface.
See Also
Refactoring (C#)
       Extract a method in C#
       10/31/2017 • 1 min to read • Edit Online
What: Lets you turn a fragment of code into its own method.
When: You have a fragment of existing code in some method that needs to be called from another method.
Why: You could copy/paste that code, but that would lead to duplication. A better solution is to refactor that
fragment into its own method which can be called freely by any other method.
How:
1. Highlight the code to be extracted:
2. Next, do one of the following:
      Keyboard
        Press Ctrl+R, then Ctrl+M. (Note that your keyboard shortcut may be different based on which
        profile you've selected.)
        Press Ctrl+. to trigger the Quick Actions and Refactorings menu and select Extract Method
        from the Preview window popup.
      Mouse
        Select Edit > Refactor > Extract Method.
        Right-click the code and select Refactor > Extract > Extract Method.
        Right-click the code, select the Quick Actions and Refactorings menu and select Extract
        Method from the Preview window popup.
   The method will be immediately created. From here, you can now rename the method simply by typing the
   new name.
     TIP
     You can also update comments and other strings to use this new name, as well as preview changes before saving,
     using the checkboxes in the Rename box which appears at the top right of your IDE.
3. When you're happy with the change, click the Apply button or press Enter and the changes will be
   committed.
See Also
Refactoring (C#)
Preview Changes
       Inline a temporary variable with C#
       10/31/2017 • 1 min to read • Edit Online
What: Lets you remove the use of a temporary variable and replace it with the actual code instead.
When: The use of the temporary variable makes the code harder to understand.
Why: Removing a temporary variable may make the code easier to read in certain situations
How:
1. Highlight or place the text cursor inside the temporary variable to be inlined:
2. Next, do one of the following:
      Keyboard
         Press Ctrl+. to trigger the Quick Actions and Refactorings menu and select Inline temporary
         variable from the Preview window popup.
      Mouse
         Right-click the code, select the Quick Actions and Refactorings menu and select Inline
         temporary variable from the Preview window popup.
   The variable will be removed and its usages replaced by the value of the variable immediately.
See Also
Refactoring (C#)
       Move a type to a matching file in C#
       10/31/2017 • 1 min to read • Edit Online
What: Lets you move the selected type to a separate file with the same name.
When: You have multiple classes, structs, interfaces, etc. in the same file which you want to separate.
Why: Placing multiple types in the same file can make it difficult to find these types. By moving types to files with
the same name, code becomes more readable and easier to navigate.
How:
1. Highlight or place the text cursor inside the name of the type to move:
2. Next, do one of the following:
      Keyboard
         Press Ctrl+. to trigger the Quick Actions and Refactorings menu and select Move type to
         TypeName.cs from the Preview window popup, where TypeName is the name of the type you
         have selected.
      Mouse
         Right-click the code, select the Quick Actions and Refactorings menu and select Move type to
         TypeName.cs from the Preview window popup, where TypeName is the name of the type you
         have selected.
   The type will instantly moved to a new file with that name inside of your solution.
See Also
Refactoring (C#)
       Rename a code symbol in C#
       10/31/2017 • 1 min to read • Edit Online
What: Lets you rename identifiers for code symbols, such as fields, local variables, methods, namespaces,
properties and types.
When: You want to safely rename something without having to find all instances, and copy/paste the new name.
Why: Copy and pasting the new name across an entire project would likely result in errors. This refactoring tool
will accurately perform the renaming action.
How:
1. Highlight or place the text cursor inside the item to be renamed:
2. Next, do one of the following:
     Keyboard
        Press Ctrl+R, then Ctrl+R. (Note that your keyboard shortcut may be different based on which
        profile you've selected.)
     Mouse
        Select Edit > Refactor > Rename.
        Right-click the code and select Rename.
3. Rename the item simply by typing the new name.
     TIP
     You can also update comments and other strings to use this new name, as well as preview changes before saving,
     using the checkboxes in the Rename box which appears at the top right of your IDE.
4. When you're happy with the change, click the Apply button or press Enter and the changes will be
   committed.
  NOTE
  If you use a name that already exists which would cause a conflict, the Rename box in your IDE will warn you.
See Also
Refactoring (C#)
Preview Changes
       Sync a type to a filename, or a filename to a type in
       C#
       10/31/2017 • 1 min to read • Edit Online
This feature is available in Visual Studio 2017 and later. Additionally, .NET Standard projects are not yet
supported for this refactoring.
What: Lets you rename a type to match the filename, or rename a filename to match the type it contains.
When: You have renamed a file or type and haven't yet updated the corresponding file or type to match.
Why: Placing a type in a file with a different name, or vice-versa, it difficult to find what you're looking for. By
renaming either the type or filename, code becomes more readable and easier to navigate.
How:
1. Highlight or place the text cursor inside the name of the type to synchronize:
2. Next, do one of the following:
      Keyboard
         Press Ctrl+. to trigger the Quick Actions and Refactorings menu and select Rename file to
         TypeName.cs from the Preview window popup, where TypeName is the name of the type you
         have selected.
         Press Ctrl+. to trigger the Quick Actions and Refactorings menu and select Rename type to
         Filename from the Preview window popup, where Filename is the name of the current file.
      Mouse
         Right-click the code, select the Quick Actions and Refactorings menu, and select Rename file
         to TypeName.cs from the Preview window popup, where TypeName is the name of the type you
         have selected.
         Right-click the code, select the Quick Actions and Refactorings menu, and select Rename type
         to Filename from the Preview window popup, where Filename is the name of the current file.
   The type or file will instantly be renamed. In the example below, the file MyClass.cs was renamed to
   MyNewClass.cs to match the type name.
See Also
Refactoring (C#)
       Code generation features for C#
       10/31/2017 • 1 min to read • Edit Online
Visual Studio can help generate portions of source code for you, letting you focus on the real work. The following
code generation features are available in Visual Studio for C#:
   Generate Class/Type
   Generate Method
   Generate Field/Property/Local
   Generate Constructor
   Generate Override
   Generate XML Documentation Comments
   Implement Abstract Class
   Implement Interface
   Introduce Local Variable
See Also
Using the Visual Studio Development Environment for C#
       Generate a class or type in C#
       10/31/2017 • 1 min to read • Edit Online
What: Lets you immediately generate the code for a class or type.
When: You introduce a new class or type and want to properly declare it, automatically.
Why: You could declare the class or type before using it, however this feature will generate the class or type
automatically.
How:
1. Place your cursor on the line where there is a red squiggle indicating you've used a class that doesn't yet
   exist.
2. Next, do one of the following:
       Keyboard
         Press Ctrl+. to trigger the Quick Actions and Refactorings menu and select one of the options
         from the Preview window popup.
       Mouse
         Right-click and select the Quick Actions and Refactorings menu and select one of the options
         from the Preview window popup.
          Hover over the red squiggle and click the        icon which appears.
          Click the      icon which appears in the left margin if the text cursor is already on the line with
          the red squiggle.
     SELECTION                                                 DESCRIPTION
     Generate class 'TypeName' in new file                     Creates a class named TypeName in a file named
                                                               TypeName.cs/.vb
     Generate class 'TypeName'                                 Creates a class named TypeName in the current file.
     SELECTION                                                    DESCRIPTION
     Generate nested class 'TypeName'                             Creates a class named TypeName nested inside the
                                                                  current class.
     Generate new type...                                         Creates a new class or struct with all of the properties you
                                                                  specify.
     TIP
     Use the Preview changes link at the bottom of the preview window to see all of the changes that will be made
     before making your selection.
3. If you select the Generate new type... item, a dialog box will pop up that allows you to perform some
   additional actions.
     SELECTION                                                    DESCRIPTION
     Access                                                       Set the type to have Default, Internal or Public access.
     Kind                                                         This can be set as class or struct.
     Name                                                         This cannot be changed and will be the name you already
                                                                  typed.
     Project                                                      If there are multiple projects in your solution, you can
                                                                  choose where you want the class/struct to live.
     File Name                                                    You can create a new file or you can add the type to an
                                                                  existing file.
4. The class/struct will be created automatically with the constructor inferred from its usage.
See Also
Code Generation (C#)
Preview Changes
       Generate a method in C#
       10/31/2017 • 1 min to read • Edit Online
What: Lets you immediately add a method to a class.
When: You introduce a new method and want to properly declare it, automatically.
Why: You could declare the method and parameters before using it, however this feature will generate the
declaration automatically.
How:
1. Place your cursor on the line where there is a red squiggle indicating you've used a method that doesn't yet
   exist.
2. Next, do one of the following:
       Keyboard
         Press Ctrl+. to trigger the Quick Actions and Refactorings menu and select Generate method
         from the Preview window popup.
       Mouse
         Right-click and select the Quick Actions and Refactorings menu and select Generate method
         from the Preview window popup.
         Hover over the red squiggle and click the           icon which appears.
         Click the      icon which appears in the left margin if the text cursor is already on the line with
         the red squiggle.
     TIP
     Use the Preview changes link at the bottom of the preview window to see all of the changes that will be made
     before making your selection.
3. The method will be created automatically with any parameters inferred from its usage.
See Also
Code Generation (C#)
Preview Changes
       Generate a field, property, or local in C#
       10/31/2017 • 1 min to read • Edit Online
What: Lets you immediately generate the code for a previously undeclared field, property, or local.
When: You introduce a new field, property or local while typing and want to properly declare it, automatically.
Why: You could declare the field, property or local before using it, however this feature will generate the
declaration and type automatically.
How:
1. Place your cursor on the line where there is a red squiggle indicating you've used a field, local or property
   that doesn't yet exist.
2. Next, do one of the following:
       Keyboard
         Press Ctrl+. to trigger the Quick Actions and Refactorings menu and select Generate
         field/property/local from the Preview window popup.
       Mouse
         Right-click and select the Quick Actions and Refactorings menu and select Generate
         field/property/local from the Preview window popup.
         Hover over the red squiggle and click the           icon which appears.
         Click the      icon which appears in the left margin if the text cursor is already on the line with
         the red squiggle.
     TIP
     Use the Preview changes link at the bottom of the preview window to see all of the changes that will be made
     before making your selection.
3. The field, property or local will be created automatically with the type inferred from its usage.
See Also
Code Generation (C#)
Preview Changes
       Generate a constructor in C#
       10/31/2017 • 1 min to read • Edit Online
What: Lets you immediately generate the code for a new constructor on a class.
When: You introduce a new constructor and want to properly declare it, automatically.
Why: You could declare the constructor before using it, however this feature will generate it, with the proper
parameters, automatically.
How:
1. Place your cursor on the line where there is a red squiggle indicating you've used a constructor that doesn't
   yet exist.
2. Next, do one of the following:
       Keyboard
         Press Ctrl+. to trigger the Quick Actions and Refactorings menu and select Generate
         constructor in 'TypeName' from the Preview window popup.
       Mouse
         Right-click and select the Quick Actions and Refactorings menu and select Generate
         constructor in 'TypeName' from the Preview window popup.
         Hover over the red squiggle and click the           icon which appears.
         Click the      icon which appears in the left margin if the text cursor is already on the line with
         the red squiggle.
     TIP
     Use the Preview changes link at the bottom of the preview window to see all of the changes that will be made
     before making your selection.
3. The constructor will be created automatically with any parameters inferred from its usage.
See Also
Code Generation (C#)
Preview Changes
       Generate an override in C#
       10/31/2017 • 1 min to read • Edit Online
What: Lets you immediately generate the code for a any method which can be overridden from a base class.
When: You want to override a base class method and generate the signature automatically.
Why: You could write the method signature yourself, however this feature will generate the signature
automatically.
How:
1. Type the override keyword, followed by a space, where you would like to insert an overridden method
   signature and an IntelliSense dropdown will appear.
2. Select the method you would like to override from the base class by clicking it with the mouse, or navigating
   to it with the keyboard and pressing Enter.
     TIP
        Use the Property icon   to show or hide Properties in the list.
        Use the Method icon     to show or hide Methods in the list.
3. The selected method or property will be added to the class as an override, ready to be implemented.
See Also
Code Generation (C#)
       Generate XML documentation comments in C#
       10/31/2017 • 1 min to read • Edit Online
What: Lets you immediately generate the base XML required to document the selected element.
When: You want to create XML Document Comments for later processing by a documentation tool like Sandcastle.
Why: You could manually create the entire comment block yourself, however this will save time and improve
accuracy by generating the base template and additional elements.
How:
1. Place your text cursor above the element you want to document, for example, a method.
2. Next, type /// (3 forward slashes) which will automatically create the base template and any additional
   elements as necessary. For example, when commenting a method, it will generate the <summary> tags as
   well as a <param> tag for every parameter that is passed to the method, and a <returns> tag to document
   what the method returns.
3. Complete the comments and add any additional information you feel is necessary.
See Also
Code Generation (C#)
XML Documentation Comments (C# Programming Guide)
       Implement an abstract class in C#
       10/31/2017 • 1 min to read • Edit Online
What: Lets you immediately generate the code required to implement an abstract class.
When: You want to inherit from an abstract class.
Why: You could manually implement all abstract members one-by-one, however this feature will generate all
method signatures automatically.
How:
1. Place your cursor on the line where there is a red squiggle indicating you have inherited from an abstract
   class but have not implemented all required members.
2. Next, do one of the following:
       Keyboard
         Press Ctrl+. to trigger the Quick Actions and Refactorings menu and select Implement
         Abstract Class from the Preview window popup.
       Mouse
         Right-click and select the Quick Actions and Refactorings menu and select Implement
         Abstract Class from the Preview window popup.
         Hover over the red squiggle and click the        icon which appears.
         Click the      icon which appears in the left margin if the text cursor is already on the line with
         the red squiggle.
     TIP
     Use the Preview changes link at the bottom of the preview window to see all of the changes that will be made
     before making your selection.
     Additionally, you can use the Document, Project, and Solution links at the bottom of the preview window to create
     the proper method signatures across multiple classes which inherit from the abstract class.
3. The abstract method signatures will be created automatically, ready to be implemented.
See Also
Code Generation (C#)
Preview Changes
       Implement an interface in C#
       10/31/2017 • 1 min to read • Edit Online
What: Lets you immediately generate the code required to implement an interface.
When: You want to inherit from an interface.
Why: You could manually implement all interface one-by-one, however this feature will generate all method
signatures automatically.
How:
1. Place your cursor on the line where there is a red squiggle indicating you have referenced an interface but
   have not implemented all required members.
2. Next, do one of the following:
       Keyboard
         Press Ctrl+. to trigger the Quick Actions and Refactorings menu and select Implement
         interface (explicitly) from the Preview window popup.
       Mouse
         Right-click and select the Quick Actions and Refactorings menu and select Implement
         interface (explicitly) from the Preview window popup.
         Hover over the red squiggle and click the        icon which appears.
         Click the      icon which appears in the left margin if the text cursor is already on the line with
         the red squiggle.
     TIP
     Use the Preview changes link at the bottom of the preview window to see all of the changes that will be made
     before making your selection.
     Additionally, you can use the Document, Project, and Solution links at the bottom of the preview window to create
     the proper method signatures across multiple classes which implement the interface.
3. The interface's method signatures will be created automatically, ready to be implemented.
     TIP
     Use the Implement interface explicitly option to preface each generated method with the interface name to avoid
     name collisions.
See Also
Code Generation (C#)
Preview Changes
       Introduce a local variable in C#
       10/31/2017 • 1 min to read • Edit Online
What: Lets you immediately generate a local variable to replace an existing expression.
When: You have code which could be easily reused later if it were in a local variable.
Why: You could copy and paste the code multiple times to use it in various locations, however it would be better to
perform the operation once, store the result in a local variable, and use the local variable throughought.
How:
1. Highlight the expression that you want to assign to a new local variable.
2. Next, do one of the following:
       Keyboard
         Press Ctrl+. to trigger the Quick Actions and Refactorings menu and select Introduce local
         for (all occurrences of) 'expression' from the Preview window popup, where expression is the
         code you have highlighted.
       Mouse
         Right-click and select the Quick Actions and Refactorings menu and select Introduce local for
         (all occurrences of) 'expression' from the Preview window popup, where expression is the code
         you have highlighted.
         Click the      icon which appears in the left margin if the text cursor is already on the line with
         the red squiggle.
     TIP
     Use the Preview changes link at the bottom of the preview window to see all of the changes that will be made
     before making your selection.
3. The local variable will be created automatically with the type inferred from its usage. Give the new local
   variable a new name by typing it.
    NOTE
    You can use the ...all occurences of... menu option to replace every instance of the selected expression found, not
    just the one you have specifically highlighted.
See Also
Code Generation (C#)
Preview Changes