ReSharper有一个奇特的功能,突出显示格式变量,例如string.Format():

现在,我已经编写了一个扩展来格式化字符串,如:
public static string FormatWith(this string me, params object[] args) {
return string.Format(me, args);
}
Run Code Online (Sandbox Code Playgroud)
所以我可以这样做:

现在我想实现类似的语法高亮{0}和{1}一个字符串,然后每当.FormatWith.ReSharper有可能这样吗?
您可以通过在JetBrains.Annotations包中使用StringFormatMethodAttribute来完成此操作.
[StringFormatMethod("me")]
public static string FormatWith(this string me, params object[] args) {
return string.Format(me, args);
}
Run Code Online (Sandbox Code Playgroud)