Click here to Skip to main content
15,922,407 members
Home / Discussions / C#
   

C#

 
GeneralRe: using static Pin
Christian Graus29-Mar-04 13:18
protectorChristian Graus29-Mar-04 13:18 
GeneralRe: using static Pin
Heath Stewart29-Mar-04 18:00
protectorHeath Stewart29-Mar-04 18:00 
GeneralJagged edges on custom shaped form Pin
Flack29-Mar-04 12:30
Flack29-Mar-04 12:30 
GeneralRe: Jagged edges on custom shaped form Pin
Roman Rodov29-Mar-04 12:36
Roman Rodov29-Mar-04 12:36 
GeneralRe: Jagged edges on custom shaped form Pin
Heath Stewart29-Mar-04 17:53
protectorHeath Stewart29-Mar-04 17:53 
GeneralDetecting Mouse Movement While Button Down Pin
Tristan Rhodes29-Mar-04 11:23
Tristan Rhodes29-Mar-04 11:23 
GeneralRe: Detecting Mouse Movement While Button Down Pin
Dave Kreskowiak29-Mar-04 11:29
mveDave Kreskowiak29-Mar-04 11:29 
GeneralRe: Detecting Mouse Movement While Button Down Pin
Heath Stewart29-Mar-04 17:42
protectorHeath Stewart29-Mar-04 17:42 
GeneralPointers Pin
Roger H Art29-Mar-04 9:32
sussRoger H Art29-Mar-04 9:32 
GeneralRe: Pointers Pin
Judah Gabriel Himango29-Mar-04 9:52
sponsorJudah Gabriel Himango29-Mar-04 9:52 
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 

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.