Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Beta Versions
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Beta Versions This forum is the place to discuss issues regarding Basic4ppc beta versions.

Question about structures

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-04-2010, 10:05 AM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 918
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default Question about structures

Code:
Note that it is still not possible to pass or return arrays and structures
It is possible for a method in a library to refer to an array as an argument in the method, and it is actually by reference.

Since structure is an array, it can also be referenced in the method.

The method has strong typing, hence the type of the array must be the same as in the program.

If I want to use a structure which contains various types (say number and string) - it is not accepted by the method and on the other hand it can't be declared in the b4ppc other than leave it as default string.

I tried to declare the items of the structure inside the type declaration but it does not accept it.

I still want to use part of the structure and copy from it within the method, how can I refer to this mixed structure in c# ?

the work around is of course to create in the program another partial structure with only the necessary parts, but this is loading the program.

thanks for any clarifying answer.

Edit: I forgot the other way - to leave it as string and to convert it in the method. I'll try that, but would like to understand more anyway.
Edit: the last idea works.
__________________
David Erez
Ramat Hasharon, Israel

Last edited by derez : 03-04-2010 at 11:08 AM.
Reply With Quote
  #2 (permalink)  
Old 03-04-2010, 12:42 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Because a "structure" in Basic4ppc is not really a structure but an array it can only hold items of a single type - unlike a .NET structure. A Basic4ppc "structure" is really only an indexing convenience.

To pass a Basic4ppc "structure" to a library you need to define a method parameter or property as an array of the correct type and rank. You can return an array of the correct type and rank to Basic4ppc as a method return or property. C# structs cannot be passed to or from a library as Basic4ppc only knows about arrays and variables.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #3 (permalink)  
Old 03-04-2010, 01:44 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 918
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Thank you.
__________________
David Erez
Ramat Hasharon, Israel
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Legal Structures ?? adbftrainer Questions (Windows Mobile) 9 09-09-2008 06:54 PM
Create an array of structures serge Questions (Windows Mobile) 1 06-21-2008 08:55 PM
How to redimension an array of structures HARRY Code Samples & Tips 3 02-20-2008 12:53 PM
How to declare array of structures of bytes HARRY Questions (Windows Mobile) 3 02-13-2008 05:28 PM
Structures & Uppercase skipper Questions (Windows Mobile) 4 02-06-2008 07:00 AM


All times are GMT. The time now is 01:22 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0