TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
csharphelp
NA
1
0
managing objects in callback
Jun 5 2008 3:59 PM
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
Answers (
0
)
Help Creating an Error Handler
configuration manager question