managing object in callback

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2008
Posts: 1
Reputation: csharphelp24 is an unknown quantity at this point 
Solved Threads: 0
csharphelp24 csharphelp24 is offline Offline
Newbie Poster

managing object in callback

 
0
  #1
Jun 5th, 2008
I have a program that gets callback from an external program. It sends back a type object[] that is of variable length. I want to take the parts of the object[] and put them into native data types (int). In the callback, I get an object called 'ObjectOfIntegers'. It has a built in method (from the third party application called 'get'. 'get' returns an object[] that has all the things i ask for. The third party program's 'get' function obviously is the barrier. so it looks something like this:

ObjectOfIntegers.get("Integer1,Integer2")

or it could be

ObjectOfIntegers.get("Integer1,String1")

If I know I am getting integers, I want to be able to put them in native data types and then use them (ie put them in myInteger1, myIntegery2, myString1, etc). so i declare the integers and strings globally and then want their assignment to be done in the callback. i've tried these two ways:

1)
private int[] intArraySize2 = new int[2];
private int myInteger1, myInteger2;

private void someCallbackFunction(ThirdPartyDataType ObjectOfIntegers)
{
Array.Copy(((Array)ObjectOfIntegers.get_Get("Integer1,Integer2")), intArraySize2, 2);

myInteger1= intArraySize2[0];
myInteger2= intArraySize2[1];
}

2)
private Object[] dataObject = null;
private int myInteger1, myInteger2;

private void someCallbackFunction(ThirdPartyDataType ObjectOfIntegers)
{
dataObject = (Object[])ObjectOfIntegers.get_Get("Integer1,Integer2");

myInteger1= (int)dataObject.GetValue(0);
myInteger2= (int)dataObject.GetValue(1);
}


Does anyone know which would be faster? Is there a better way to handle this? Speed is the most important issue to me. If anyone has any ideas of what to do, how to do it faster, or where to go for more information I would REALLY appreciate it. Thanks so much.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC