What is a equivalent of Visual basic 'vbNullChar" in c# ?
i want to replicate this VB statement in C#
Dim sVersion As String
sVersion = New String(vbNullChar, 255)
I suspect you want:
string sVersion = new string('\0', 255);
(This seems like an odd thing to want to do though. I would try taking a step back and seeing whether there isn't a more appropriate approach to the bigger problem.)
Jon Skeet is correct...
Also you can achieve this thing by below method...
1st Way
char vbNullChar = Convert.ToChar(0);//C# Equivalent to vbNullChar
string sVersion = new string(vbNullChar, 255);
2nd Way
char vbNullChar = Convert.ToChar(0x0);//C# Equivalent to vbNullChar
string sVersion = new string(vbNullChar, 255);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With