Home > Code Analysis > Code Issues – Property cannot have void type

Code Issues – Property cannot have void type

January 22nd, 2011

Cause:

A property is a member that provides a flexible mechanism to read, write, or compute the value of a field, thus it cannot have a void type. Properties are actually special methods called accessors (getter or setter) and they must have a specific non-void type according to most language specifications.

Sample:

CodeRush Property Cannot Have Void Type Sample

How to fix:

Change the type of the property, e.g.,:

CodeRush Property Cannot Have Void Type Fix

—–
Products: CodeRush Pro
Versions: 12.1 and up
VS IDEs: any
Updated: Nov/19/2012
ID: C051

Similar Posts: