LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 02-22-2004, 10:16 PM   #1
exodist
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, 12:15 AM   #2
exodist
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, 09:41 AM   #3
rednael
LQ Newbie
 
Registered: Sep 2008
Posts: 2

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

Rep: Reputation: 120Reputation: 120
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.
 
  


Reply


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 07:11 AM
C Problem---convert char to char* totti10 Programming 11 11-06-2004 11:32 AM
Convert C++ string to C char* nyk Programming 3 06-17-2004 08:15 AM
java test if string in string array is null. exodist Programming 3 02-21-2004 01:39 PM
convert from char* to unsigned char* D J Linux - Software 2 02-20-2004 04:09 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:13 AM.

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