2

I have this line of code:

strKey &= Strings.StrDup(intKeySize - intLength, chrKeyFill)

What is the equivalent of this code in C#? I can't seem to find it.

Michael Bahig
  • 748
  • 8
  • 17
ErocM
  • 4,505
  • 24
  • 94
  • 161

3 Answers3

9
strKey += new String(chrKeyFill, intKeySize - intLength);

or

strKey = strKey.PadRight(intKeySize, chrKeyFill)
Jon
  • 969
  • 4
  • 9
0

Personally I think the String constructor approach is clumsy and less readable than the VB.Net Strings library.

 using Microsoft.VisualBasic;
 ...
 Strings.StrDup(2, '\t');
Michael Bahig
  • 748
  • 8
  • 17
0
strKey += strKey.PadRight(strKey.Length + (intKeySize - intLength), chrKeyFill)
Bala R
  • 107,317
  • 23
  • 199
  • 210