Function equivalent to Chr$ in C#

I am migrating a snippet of code into Visual Basic 6 and came across the following Call:

variavel = Chr$(27) & Chr(15)

1-What would be the equivalent functions in C#?

2 - what is the difference between Chr$ and Chr?

Author: Maniero, 2019-10-15

1 answers

Just make a cast from the number to char, something like this:

(char)27

But probably should do something different, the semantics of the language changes so it's not usually just translate an expression, it must have another way of doing it in C#, who knows even in VB6 it was already wrong to do this. One of the reasons I think this is that it makes no sense to use the two forms of the function chr, one that returns String and another that returns a Variant.

In C# probably use this:

"\u0027\u0015"
 3
Author: Maniero, 2019-10-16 11:25:12