Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 02-22-2004, 11:16 PM   #1
Senior Member
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Gentoo
Posts: 1,372

Rep: Reputation: 47
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?
Old 02-23-2004, 01:15 AM   #2
Senior Member
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Gentoo
Posts: 1,372

Original Poster
Rep: Reputation: 47
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);
Old 09-11-2008, 10:41 AM   #3
LQ Newbie
Registered: Sep 2008
Posts: 2

Rep: Reputation: 0
Thumbs up Marshalling: Using native DLLs in .NET

Please read the following article:

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.
Old 09-16-2008, 09:06 AM   #4
Senior Member
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120

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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert string to char? twirl Programming 27 10-13-2005 08:11 AM
C Problem---convert char to char* totti10 Programming 11 11-06-2004 12:32 PM
Convert C++ string to C char* nyk Programming 3 06-17-2004 09:15 AM
java test if string in string array is null. exodist Programming 3 02-21-2004 02:39 PM
convert from char* to unsigned char* D J Linux - Software 2 02-20-2004 05:09 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:44 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration