Skip to content

Commit 2ec5524

Browse files
Merge branch 'master' into amburns-vsmac-build
2 parents 1bc54fe + 9e7f64d commit 2ec5524

11 files changed

+119
-11
lines changed
18.4 KB
Loading
Loading
Loading
Loading
29.5 KB
Loading
Loading
7.44 KB
Loading
18.5 KB
Loading
22.9 KB
Loading

docs/ide/quick-actions.md

Lines changed: 97 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
---
22
title: "Quick Actions | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "03/10/2017"
4+
ms.date: "05/08/2017"
55
ms.reviewer: ""
66
ms.suite: ""
7-
ms.technology:
7+
ms.technology:
88
- "vs-ide-general"
99
ms.tgt_pltfrm: ""
1010
ms.topic: "article"
1111
ms.devlang: csharp
1212
ms.assetid: e173fb7d-c5bd-4568-ba0f-aa61913b3244
13-
author: "BrianPeek"
14-
ms.author: "brpeek"
13+
author: "kempb"
14+
ms.author: "kempb"
1515
manager: "ghogen"
1616
dev_langs:
1717
- CSharp
1818
- VB
19-
translation.priority.ht:
19+
translation.priority.ht:
2020
- "cs-cz"
2121
- "de-de"
2222
- "es-es"
@@ -100,7 +100,7 @@ switch(myEnum)
100100
case MyEnum.Item3:
101101
break;
102102
default:
103-
break;
103+
break;
104104
}
105105
```
106106

@@ -308,7 +308,7 @@ Debug.WriteLine("Hello")
308308
```
309309

310310
### Convert to Interpolated String
311-
[Interpolated strings](/dotnet/articles/csharp/language-reference/keywords/interpolated-strings) are an easy way to express strings with embedded variables, similar to the **[String.Format](https://msdn.microsoft.com/library/system.string.format(v=vs.110).aspx)** method. This Quick Action will recognize cases where strings are concatenated, or using **String.Format**, and change the usage to an interpolated string.
311+
[Interpolated strings](/dotnet/articles/csharp/language-reference/keywords/interpolated-strings) are an easy way to express strings with embedded variables, similar to the **[String.Format](https://msdn.microsoft.com/library/system.string.format.aspx)** method. This Quick Action recognizes cases where strings are concatenated, or using **String.Format**, and changes the usage to an interpolated string.
312312

313313
```CSharp
314314
// Before
@@ -334,5 +334,94 @@ Dim num as Integer = 3
334334
Dim s As String = $"My string with {num} in the middle"
335335
```
336336

337+
### Remove merge conflict markers
338+
These Quick Actions enable you to resolve merge conflicts by "taking a change", which removes the conflicting code and markers. (Available only in Visual Studio 2017 (version 15.3 - Preview).)
339+
340+
![Refactoring - resolve merge conflicts](../ide/media/vside-refactoring-merge-conflicts.png)
341+
342+
### Add null checks for parameters
343+
This Quick Action enables you to add a check in your code to tell whether a parameter is null. (Available only in Visual Studio 2017 (version 15.3 - Preview).)
344+
345+
![Refactoring - add null check](../ide/media/vside-refactoring-nullcheck.png)
346+
347+
### Constructor generator improvements
348+
When you're creating a constructor, this Quick Action enables you to select the properties or fields to generate, or you can generate the constructor from an empty body. You can also use it to add parameters to an existing constructor from the call-site. (Available only in Visual Studio 2017 (version 15.3 - Preview).)
349+
350+
![Refactoring - generate constructors](../ide/media/vside-refactoring-constructors.png)
351+
352+
### Remove unused variables
353+
This Quick Action enables you to remove variables that have been declared but never used in your code. (Available only in Visual Studio 2017 (version 15.3 - Preview).)
354+
355+
![Refactoring - unused variables](../ide/media/vside-refactoring-unusedvars.png)
356+
357+
### Generate overrides
358+
This Quick Action enables you to create an override from a blank line in a class or struct. The **Pick Members** dialog box lets you choose the members to override. (Available only in Visual Studio 2017 (version 15.3 - Preview).)
359+
360+
![Refactoring - overrides](../ide/media/vside-refactoring-overrides.png)
361+
362+
![Refactoring - overrides dialog box](../ide/media/vside-refactoring-overrides-dialog.png)
363+
364+
### Change base for numeric literals
365+
This Quick Action enables you to convert a numeric literal from one base numeric system to another. For example, you can change a number to hexadecimal or to binary format. (Available only in Visual Studio 2017 (version 15.3 - Preview).)
366+
367+
![Refactoring - change base](../ide/media/vside-refactoring-changebase1.png)
368+
369+
![Refactoring - change base](../ide/media/vside-refactoring-changebase2.png)
370+
371+
### Insert digit separators into literals
372+
This Quick Action enables you to add separator characters into literal values. (Available only in Visual Studio 2017 (version 15.3 - Preview).)
373+
374+
![Refactoring - change digit separators](../ide/media/vside-refactoring-separators.png)
375+
376+
### Convert **if** construct to **switch**
377+
This Quick Action enables you to convert an **if-then-else** construct to a **switch** construct. (Available only in Visual Studio 2017 (version 15.3 - Preview).)
378+
379+
```CSharp
380+
// Before
381+
if (obj is string s)
382+
{
383+
Console.WriteLine("obj is a string: " + s);
384+
}
385+
386+
else if (obj is int i && i > 10)
387+
{
388+
Console.WriteLine("obj is an int greater than 10");
389+
}
390+
391+
// Convert to switch
392+
393+
// After
394+
switch (obj)
395+
{
396+
case string s:
397+
Console.WriteLine("Obj is a string: " + s);
398+
break;
399+
case int i when i > 10:
400+
Console.WriteLine("obj is an int greater than 10");
401+
break;
402+
}
403+
```
404+
405+
```VB
406+
' Before
407+
If TypeOf obj Is String s Then
408+
Console.WriteLine("obj is a string: " + s)
409+
Else If TypeOf obj Is Integer i And i > 10 Then
410+
Console.WriteLine("obj is an int greater than 10")
411+
End If
412+
413+
' Convert to switch
414+
415+
' After
416+
Select Case obj
417+
Case String s
418+
Console.WriteLine("Obj is a string: " + s)
419+
Exit Sub
420+
Case Integer i when i > 10
421+
Console.WriteLine("obj is an int greater than 10")
422+
Exit Sub
423+
End Select
424+
```
425+
337426
# See Also
338-
* [Code Styles and Quick Actions](code-styles-and-quick-actions.md)
427+
* [Code Styles and Quick Actions](code-styles-and-quick-actions.md)

0 commit comments

Comments
 (0)