Show/Hide Toolbars

XSharp

Foreach cannot operate on a 'Method or Delegate'. Did you intend to invoke the 'Method or Delegate'?

 

This error is caused by specifying a method without parentheses or an anonymous method without parentheses in the part of the foreach statement where you would normally put a collection class. Note that it is valid, though unusual, to put a method call in that location, if the method returns a collection class.

Example

 

The following code will generate XS0446.

 

 

// XS0446.prg