How do I convert an object back into an array of strings?
Here's the deal. I have some string vectors that I want to put on a stack. (No clue how to do that.) So I put them as objects into another vector and took them back out. OK so far, but I don't know how to get my string vectors back. The IDE thinks there's a method for it, but I can't find it.
Please help.
Jim
Loading
Jim FlintPosted Aug 18, 2010, 3:24 PM
The problem was converting an object back into string vectors.
There's a great answer with lots of references.
Yes, the code works. You can step through it and watch the whole process.
Sorry that the code didn't have any explanation. I meant to get back and annotate it, but ...
If you find this, but can't find the thread, I don't quite know what to do. I suppose I could paste it all together for another reply.
Cheers
Jim
Sam HobbsPosted Aug 18, 2010, 12:56 PM
Does your test program work? Does it do what you need done?
Jim FlintPosted Aug 17, 2010, 6:27 PM
namespace ObjectArrayTest
{
class Program
{
static void Main(string[] args)
{
string[] OutStringVector0 = { "a ", "b" };
string[] OutStringVector1 = { "c", "d" };
Object[] OutboundObject = { OutStringVector0, OutStringVector1 };
object[] InboundObject = Loopback(OutboundObject);
string[] InStringVector0 = (string[]) InboundObject[0];
string FirstString = InStringVector0[0];
}
static object[] Loopback(object[] InputStuff)
{
return (InputStuff);
}
}
}
Jim FlintPosted Aug 15, 2010, 1:41 PM
"
This message was created by Mindcracker Network Site Administration.
*** PLEASE DO NOT REPLY THIS MESSAGE ***
This message has been sent from an unattended email box.
Hi Jim,
Check out these possible articles for your problem.
Title: object conversion
1. Silverlight Data Binding vs. WPF
2. Type Conversions in c#
3. Convert Long to Short File Names in C#
4. Unit Conversion Tool for Pocket PC with Compact Framework
5. Working With Data Types
6. String Encoding/Decoding and Conversions in C#
7. Array Conversions in C#
8. The Convert Class : Conversion Made Easy in .NET
9. Conversion Classes & CultureInfo Class in C#
10. Text-to-Speech Conversion in C#
Thank you for using and supporting Mindcracker Network.
Sincerely
Mindcracker Network Administrator
www.c-sharpcorner.com
www.vbdotnetheaven.com
www.dotnetheaven.com
www.longhorncorner.com
"
Article 2. is excellent! It covers the general topic, I can understand it all, and the specific case works. I'm delighted. Kudos to Rajesh VS.
Many thanks.
Jim