Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How will I return an array from one method of a class to another so that the other class could consume the array, without loosing its value and without declaring the array as static...

What I have tried:

Don't know what to do...?
I have used list but with issues....
Posted
Updated 11-Jul-20 5:13am

1 solution

Please stop reposting this question. You have received enough reasons why returning arrays (whether static or not) from a method is a bad idea.
 
Share this answer
 
Comments
Member 12712527 11-Jul-20 11:18am    
Sorry Sir....I will us list for that....will it be Okay.....please reply...
I'm sure it will have no performance issue but any oher issues...
Richard MacCutchan 11-Jul-20 11:21am    
We have no idea what you are trying to do so we cannot comment. if you have a problem that you need help with then please provide proper details.
Member 12712527 11-Jul-20 11:36am    
Sir I have learned how you can use one integer or string value of one class to another class by the use of property. So I used the same for array. But it showed compiler warning--property should not be used to return arrays. So I asked for help that how you would return array from a method without declaring static....
Richard MacCutchan 11-Jul-20 12:03pm    
How many times do you need to hear this: do not return arrays from other methods. Whatever you are trying to do (and you still have not explained it) your design is wrong, and needs to be reviewed.
Member 12712527 11-Jul-20 12:16pm    
Sir I'm trying to make a database, where I would need this thing....
One more thing just came in my mind now....make a 4D image processing application...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900