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.

3 Answers 3

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

or

strKey = strKey.PadRight(intKeySize, chrKeyFill)
0
0
strKey += strKey.PadRight(strKey.Length + (intKeySize - intLength), chrKeyFill)
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');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.