我一直在使用一些C#遗留代码,我在变量名前面看到了很多@符号.这意味着什么或做什么?
目前我在变量前面看到了很多,其中常见名称没有保留.例如:
MyProcedure(@step.LoadInstanceId, @step.ResultCode, @step.StatusCode);
Run Code Online (Sandbox Code Playgroud)
鉴于该步骤不是保留字,是否有任何理由将它们转义?
使用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));
}
Run Code Online (Sandbox Code Playgroud)