471,627 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,627 software developers and data experts.

char[] to char


I'm trying to learn some basic encoding with c# for a command line
program and i have the following code:

static void Main(string[] args)
int a,b,d,z;
bool l;
string ba;
ba="Encoded: ";
for (a=0;a<b;a++)
char c = args[a].ToCharArray(); <- problem
while (d<z)
ba=ba + c + l.ToString();

I get the error Cannot implicitly convert type 'char[]' to 'char'. How
can i change this?

Feb 10 '06 #1
2 1288
> char c = args[a].ToCharArray(); <- problem

You're getting a char array back and trying to put it into a single char.

char [] c = args[a].ToCharArray(); <- solution

This is going to cause you problems further down.

Feb 10 '06 #2
k, thanks.

Feb 10 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Christopher Benson-Manica | last post: by
5 posts views Thread by Sona | last post: by
2 posts views Thread by Peter Nilsson | last post: by
5 posts views Thread by jab3 | last post: by
18 posts views Thread by Pedro Pinto | last post: by
4 posts views Thread by Paul Brettschneider | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.