Skip to content

Latest commit

 

History

History
35 lines (25 loc) · 1.04 KB

add-explicit-cast.md

File metadata and controls

35 lines (25 loc) · 1.04 KB
title description ms.date ms.topic ms.custom author ms.author manager ms.subservice
Add explicit cast
Learn how to automatically add an explicit cast to an expression based on the context of your code.
03/26/2020
reference
ide-ref
Mikejo5000
mikejo
mijacobs
general-ide

Add explicit cast

This code generation applies to:

  • C#

What: Lets you automatically add an explicit cast to an expression, based on usage.

When: You need to add an explicit cast to an expression and want to properly assign it automatically.

Why: You could add an explicit cast to an expression manually, however this feature adds it automatically based on the code context.

How to use it

  1. Place your caret on the error.

  2. Press Ctrl+. to trigger the Quick Actions and Refactorings menu.

  3. Select Add explicit cast.

    Add explicit cast quick action in Visual Studio

See also