LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   C# convert char array to string (https://www.linuxquestions.org/questions/programming-9/c-convert-char-array-to-string-149382/)

exodist 02-22-2004 10:16 PM

C# convert char array to string
 
How would I go about converting a character array to a string?

say I have a char array called ca1
its values are b, l, a, h, (0-3)

I want to convert it to a string:

String TheString = convertthistostring(ca1);

is there a function or similar way to do this?

exodist 02-23-2004 12:15 AM

I found the answer while searching google for forum results, here is what I ended up doing to test it, it worked:

String Bob = "blah!";
char[] bob = Bob.ToCharArray();

String Tet = new String(bob);

Console.WriteLine("{0}", Tet);

rednael 09-11-2008 09:41 AM

Marshalling: Using native DLLs in .NET
 
Please read the following article:
http://blog.rednael.com/2008/08/29/M...DLLsInNET.aspx

It's an in-depth article about wow to use a native DLL (or C++ DLL) in your managed .Net code? The article shows which types are interoperable, how to import a DLL, how to pass strings, how to pass structures and how to de-reference pointers.

And C# source code examples are included.

crabboy 09-16-2008 08:06 AM

rednael,

How about trying to answering the OPs question instead of attempting to drive traffic to your blog. It sure doesn't look like the OP is trying to import DLLs.


All times are GMT -5. The time now is 04:06 AM.