What is the C# equivalent of the VB Chr() Funtion?

G

Guest

Can anyone tell me what the C# equivalent of the VB Chr() Function? I need to
insert a single-byte character into a label control at run time. For example:

Dim s = "Hello" + Chr(32)
 
R

Romain A

Something like:

string s = "hello" + (char)32 + "there !";

should do the trick.

Romain
 
G

Guest

Hi,

To convert normal ASCII characters, the equivalent of Chr() in C# is to type
cast. i.e. if you using chr(97) in VB.NET to achieve the same in C# you use
char(97).

Hope this helps...

Regards,
Madhu

MVP - C# | MCSD.NET
 
B

Bob Grommes

Make that (char)97.

--Bob

Madhu said:
Hi,

To convert normal ASCII characters, the equivalent of Chr() in C# is to
type
cast. i.e. if you using chr(97) in VB.NET to achieve the same in C# you
use
char(97).

Hope this helps...

Regards,
Madhu

MVP - C# | MCSD.NET
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top