未验证 提交 253aea6e 编写于 作者: S Stephen Toub 提交者: GitHub

Remove enumerator allocation when constructing RestrictedAsciiStringEncoding (#75303)

There's only a few of these constructed, so it's not a big deal, but might as well.
上级 14f34308
......@@ -220,15 +220,12 @@ protected RestrictedAsciiStringEncoding(byte minCharAllowed, byte maxCharAllowed
bool[] isAllowed = new bool[0x80];
for (byte charCode = minCharAllowed; charCode <= maxCharAllowed; charCode++)
{
isAllowed[charCode] = true;
}
isAllowed.AsSpan(minCharAllowed, maxCharAllowed - minCharAllowed + 1).Fill(true);
_isAllowed = isAllowed;
}
protected RestrictedAsciiStringEncoding(IEnumerable<char> allowedChars)
protected RestrictedAsciiStringEncoding(string allowedChars)
{
bool[] isAllowed = new bool[0x7F];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册