Function and return values

DekaFlash

Well-known member
Joined
Feb 14, 2006
Messages
117
Programming Experience
1-3
Can a function in vb.net 2003 have multiple return types?

Regards,
Boulent
 
No, only a single return type is possible for a function, but it can be a general type, this is called boxing. For example it can return Object and this enables you to return different type objects because they all fit the Object type description. You must have an idea how to handle the return on the other end though if you put different things into 'Object'. Another option is to return a custom class or structure that consist of possible types, when returning an instance of this class or structure you only populate the appropriate member types.
 
Back
Top