User Tools

Site Tools


assign_no_returnvalue

This is an old revision of the document!


Assign cannot have a return value

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

[code][/code] [code] Warning XS9032 This entity type cannot return a value. Return value ignored. [/code]

[code]Warning XS9032 This entity type cannot return a value. Return value ignored.[/code]

The following code, perfectly valid in VO, will throw this warning in X#: [code]class MyClass

protect _cMyVar as string

assign MyVar( cMyVar ) class MyClass

_cMyVar := cMyVar

return _cMyVar[/code]

It is recommended to type the access/assign pairs in VO, like this sample: [code]class MyClass

protect _cMyVar as string

declare assign MyVar  

assign MyVar( cMyVar as string ) as void pascal class MyClass

_cMyVar := cMyVar

return _cMyVar[/code]

In this manner the compiler will you notify when you anywhere in your code have used the return value of the assign statement. (other than giving you faster and more stable code)

assign_no_returnvalue.1528355606.txt.gz · Last modified: 2018/06/07 07:13 by wolfgangriedmann