Click here to Skip to main content
15,905,875 members
Home / Discussions / C#
   

C#

 
GeneralRe: Pointers Pin
Roger H Art29-Mar-04 9:59
sussRoger H Art29-Mar-04 9:59 
GeneralRe: Pointers Pin
Judah Gabriel Himango29-Mar-04 11:23
sponsorJudah Gabriel Himango29-Mar-04 11:23 
GeneralRe: Pointers Pin
Roger H Art29-Mar-04 12:13
sussRoger H Art29-Mar-04 12:13 
GeneralRe: Pointers Pin
Roger H Art29-Mar-04 12:23
sussRoger H Art29-Mar-04 12:23 
GeneralRe: Pointers Pin
Andy Brummer29-Mar-04 16:09
sitebuilderAndy Brummer29-Mar-04 16:09 
GeneralRe: Pointers Pin
Heath Stewart29-Mar-04 17:39
protectorHeath Stewart29-Mar-04 17:39 
GeneralRe: Pointers Pin
Roger H Art30-Mar-04 1:18
sussRoger H Art30-Mar-04 1:18 
GeneralRe: Pointers Pin
Heath Stewart30-Mar-04 3:37
protectorHeath Stewart30-Mar-04 3:37 
You typically don't declare an Array, but an array of something like byte[], which I mentioned before. This does not have dimension.

Also, why not return the actual array from AFunction? All this casting is completely unnecessary. So long as this is all .NET code, you can pass and return anything, but you must understand the difference between value and reference types (you're dealing with reference types here). If AFunction is a P/Invoke method, then things are a bit different. Is this the case?

If it's all coded for .NET (no P/Invoke or COM interop), you could simply use m_arr = AFunction(Aparam); it the method was declared appropriately. Return an object or taking an object as a param is really only a good idea when you don't know what to expect (or in some polymorphic designs when derivative classes will accept different types).

The only times when assign data from a thread is a problem is when 1) you don't lock your resource and multiple threads write to it/assign at the same time, or 2) when you try to update the UI (like setting the Text property of a control or adding a ListViewItem to a ListView). For this latter case, make use of the Control.InvokeRequired property (to determine if the following method should be used) and the Control.Invoke method.

In any case, this should definitely work if its purely managed code. I do it all the time. Please provide more information (and accurate to your actual problem, instead of an example that might not be close enough to your real problem to solve it) about how this method is threaded and what AFunction is (or whatever it is in your code).

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Pointers Pin
Roger H Art30-Mar-04 6:22
sussRoger H Art30-Mar-04 6:22 
GeneralRe: Pointers Pin
Heath Stewart30-Mar-04 8:27
protectorHeath Stewart30-Mar-04 8:27 
GeneralNeed Help with Writing a IO.Stream Pin
David Flores29-Mar-04 8:32
David Flores29-Mar-04 8:32 
GeneralRe: Need Help with Writing a IO.Stream Pin
Heath Stewart29-Mar-04 8:40
protectorHeath Stewart29-Mar-04 8:40 
GeneralAccess files in use Pin
Shaun Becker29-Mar-04 7:33
Shaun Becker29-Mar-04 7:33 
GeneralRe: Access files in use Pin
Heath Stewart29-Mar-04 8:23
protectorHeath Stewart29-Mar-04 8:23 
GeneralPolymorphism and types Pin
esuyer4saic29-Mar-04 7:30
esuyer4saic29-Mar-04 7:30 
GeneralRe: Polymorphism and types Pin
Heath Stewart29-Mar-04 8:18
protectorHeath Stewart29-Mar-04 8:18 
GeneralReporting Pin
rags29-Mar-04 6:35
rags29-Mar-04 6:35 
GeneralRe: Reporting Pin
Heath Stewart29-Mar-04 8:09
protectorHeath Stewart29-Mar-04 8:09 
GeneralRe: Reporting Pin
Michael Flanakin29-Mar-04 17:25
Michael Flanakin29-Mar-04 17:25 
GeneralCustom Install Pin
dotnetdev@univ.kiev.ua29-Mar-04 6:05
dotnetdev@univ.kiev.ua29-Mar-04 6:05 
GeneralRe: Custom Install Pin
Heath Stewart29-Mar-04 8:07
protectorHeath Stewart29-Mar-04 8:07 
GeneralRe: Custom Install Pin
dotnetdev@univ.kiev.ua29-Mar-04 22:10
dotnetdev@univ.kiev.ua29-Mar-04 22:10 
GeneralRe: Custom Install Pin
Heath Stewart30-Mar-04 3:28
protectorHeath Stewart30-Mar-04 3:28 
GeneralRe: Custom Install Pin
dotnetdev@univ.kiev.ua30-Mar-04 4:18
dotnetdev@univ.kiev.ua30-Mar-04 4:18 
GeneralRe: Custom Install Pin
Heath Stewart30-Mar-04 4:24
protectorHeath Stewart30-Mar-04 4:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.