当使用 ReSharper 时,它会自动添加一个 @
,为什么?
public static string RemoveDiacritics(this string input)
{
if (string.IsNullOrEmpty(input)) return input;
var normalizedString = input.Normalize(NormalizationForm.FormD);
var stringBuilder = new StringBuilder();
foreach (var value in normalizedString.Select(value =>
new {value, unicodeCategory = CharUnicodeInfo.GetUnicodeCategory(value)})
.Where(@t => @t.unicodeCategory != UnicodeCategory.NonSpacingMark)
.Select(@t => @t.value)) stringBuilder.Append(value);
return (stringBuilder.ToString().Normalize(NormalizationForm.FormC));
}
最佳答案
@ 符号允许您为变量名使用保留关键字。如@class
。我假设 Resharper 这样做是为了安全起见。
在这种情况下,不需要它也没有任何作用。
关于c# - ReSharper 为 lambda 表达式中的变量名称提供 "@"前缀,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9304544/