【发布时间】:2011-08-19 14:57:42
【问题描述】:
我有这行代码:
strKey &= Strings.StrDup(intKeySize - intLength, chrKeyFill)
这段代码在 C# 中的等价物是什么?好像没找到。
【问题讨论】:
我有这行代码:
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');
【讨论】: