Vb.Net convert StrDub to C#.net

2019-02-25 19:38发布

问题:

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.

回答1:

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

or

strKey = strKey.PadRight(intKeySize, chrKeyFill)


回答2:

strKey += strKey.PadRight(strKey.Length + (intKeySize - intLength), chrKeyFill)


标签: c# vb.net strdup