Skip to main content

Property cannot have void type

In This Article

CodeRush Classic shows the Property cannot have void type code issue if a property is of the void type.

#Fix

Change the property type.

#Purpose

Highlights the property declarations, which would cause the Property or indexer cannot have void type compilation error.

#Example

public void MyProperty { get; set; }

Fix:

public int MyProperty { get; set; }