Show/Hide Toolbars

XSharp

This entity type cannot return a value. Return value ignored.

 

VO unfortunately permits to return a value from an assign. Since this is not permitted in .NET, the X# compiler will return an error of

Warning XS9032 This entity type cannot return a value. Return value ignored.

The following code, perfectly valid in VO, will throw this warning in X#:

class MyClass
 protect _cMyVar as string
 

access MyVar

 return _cMyVar

 
assign MyVar( cMyVar
 _cMyVar := cMyVar
 
 return _cMyVar

 

end class

 

to solve the problem simply remove the return value from the return statement inside the Assign:

class MyClass
 protect _cMyVar as string
 
access MyVar

 return _cMyVar

 
assign MyVar( cMyVar )
 _cMyVar := cMyVar
 return

 

end class

 

 

and if you are changing the code anyway it is also a good idea to add typing to your access/assign:

 

class MyClass
 protect _cMyVar as string

 
access MyVar as string

 return _cMyVar
assign MyVar( cMyVar as string )
 _cMyVar := cMyVar
 return

 

end class