Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 725 Bytes

File metadata and controls

43 lines (30 loc) · 725 Bytes
layout page
title CC0017
tagline SwitchToAutoPropAnalyzer

|TypeName|SwitchToAutoPropAnalyzer | |Check Id | CC0017 | |Category | Style | |Severity | Info |

Cause

Auto properties offer a more concise way of defining a property. If you are using simple getters and setters you are able to simplify your code with autoproperties.

Example

{% highlight csharp %} private int id; public int Id { get { return id; } set { id = value; } } {% endhighlight %}

Code fix

A code fix will be presented to you that will transform the code:

{% highlight csharp %} public int Id { get; set; } {% endhighlight %}

![Code fix]({{ BASE_PATH }}/assets/images/CC0017/codefix0.png)

Related rules

None

See also

TBD