Arrays of type 'System.Void' are not allowed in this expression

An expression in an assignment statement or a declaration specifies an array of type Void.

The Void structure is a specialized type used internally by the .NET Framework and particularly by Visual C# and Visual C++. It represents a return value type for a method that does not return a value. Visual Basic uses a Sub procedure when a value is not returned and a Function procedure when a value is returned.

Arrays of type Void are not meaningful and are not allowed in any context.

Error ID: BC31428

To correct this error

  1. Remove the parentheses that designate an array.

  2. Unless you have a particular reason to compare a run-time type to Void, remove the reference to it altogether.

See Also

Reference

Void