C# Equivalent to VB6 Chr(number)

42.6k views Asked by At

I have this code:

Dim sCenter As String
sCenter = Chr(27) + Chr(97) + Chr(1)

And I'm trying to convert to a C# code. Online converters always fail to convert... :(

So, what is the C# equivalente of Chr(number)?

Maybe Char.ConvertFromUtf32(10);

1

There are 1 answers

1
Soner Gönül On BEST ANSWER

Feel like taking risk to answer but how about?

string sCenter;
sCenter = "" + (char)27 + (char)97 + (char)1;

Thanks to James Curran's comment about char integral addition. As his suggested, I added meaningless "" with char to get string + char which uses .ToString() with String.Concat method at background.