我有这行代码:
strKey &= Strings.StrDup(intKeySize - intLength, chrKeyFill)
这段代码在 C# 中的等价物是什么?我似乎找不到它。
strKey += new String(chrKeyFill, intKeySize - intLength);
或者
strKey = strKey.PadRight(intKeySize, chrKeyFill)
strKey += strKey.PadRight(strKey.Length + (intKeySize - intLength), chrKeyFill)
就我个人而言,我认为 String 构造函数方法比 VB.Net Strings 库笨拙且可读性差。
using Microsoft.VisualBasic;
...
Strings.StrDup(2, '\t');