Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Extract data out of a seemingly complex structure

Reply
 
Old 10-29-2008   #1 (permalink)
Curious


 
 

Extract data out of a seemingly complex structure

I define a variable ("result") as object. Its value is set by
following code:

object result = splusObject.GetType().InvokeMember("ReturnValue",
System.Reflection.BindingFlags.GetProperty, null, splusObject, null);

Then both bad news and good news. Bad is that "result" seems to be a
matrix. In my debugger, it is:

Dimensions:[1..2, 1..2]}
[1, 1] 112

Good news is that it contains the correct value I want, "112".

I've tried to extract "112" out of result, but to no avail.

Any advice on how to extract "112" out of this complex structure of
result? Thanks!




My System SpecsSystem Spec
Old 10-29-2008   #2 (permalink)
Stanimir Stoyanov


 
 

Re: Extract data out of a seemingly complex structure

Judging from the debugger output, 'result' is a jagged array. If you are
sure that the result is always a jagged array the following code will let
you extract the value at [1, 1]. Make sure there are enough elements in the
matrix though, in order to avoid receiving a IndexOutOfRangeException.

int[,] b = (int[,])result;
int resultValue = b[1, 1];

--
Stanimir Stoyanov
http://stoyanoff.info

"Curious" <fir5tsight@xxxxxx> wrote in message
news:3494ebbd-ceb9-4887-a0f5-bcc221d0c5bd@xxxxxx
Quote:

>I define a variable ("result") as object. Its value is set by
> following code:
>
> object result = splusObject.GetType().InvokeMember("ReturnValue",
> System.Reflection.BindingFlags.GetProperty, null, splusObject, null);
>
> Then both bad news and good news. Bad is that "result" seems to be a
> matrix. In my debugger, it is:
>
> Dimensions:[1..2, 1..2]}
> [1, 1] 112
>
> Good news is that it contains the correct value I want, "112".
>
> I've tried to extract "112" out of result, but to no avail.
>
> Any advice on how to extract "112" out of this complex structure of
> result? Thanks!
>
>
>
My System SpecsSystem Spec
Old 10-29-2008   #3 (permalink)
Curious


 
 

Re: Extract data out of a seemingly complex structure

Thanks Stanimir! It works.
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
VB 2005 Windows forms Data Structure .NET General
Script to extract XML data VB Script
Zip extract is empty directory structure Vista file management
Complex Data Structures PowerShell
The easiest way to create an empty data structure PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46