Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to convert string to char?
Message
 
 
À
05/06/2008 12:36:13
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01321885
Message ID:
01321900
Vues:
13
Hi Bill,

I later found I don't need this property at all :)

Now I'm trying to figure out why my form is not shown at all...

>Hi Naomi,
>
>If it's for sure that letterCode will have one and only one character, then no problem. But, if for some reason it had more characters it could messy. One way to mitigate this would be to use the string ToCharArray() method ( letterCode.ToCharArray() ), then load the first character of the array into the char variable, or simply load the first character of the string which should be a char ( letterCode[0] ).
>
>Bill
>
>>Hi everybody,
>>
>>This is very simple quick question. I created a char property called PersonType. I also have a string letterCode (it declared a string, but it is actually one letter character).
>>
>>How can I do
>>this.PersonType = letterCode ;
>>
>>I tried this.PersonType = (char) letterCode; but this didn't work.
>>
>>Thanks in advance.
>>
>>UPDATE. Took a minute break and the answer came to me.
>>
>>this.PersonType = Convert.ToChar(letterCode);
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform