StringFormatMethodAttribute - конструктор

Indicates that the marked method builds string by format pattern and (optional) arguments. Parameter, which contains format string, should be given in constructor. The format string should be in Format(IFormatProvider, String, Object) -like form

Definition

Пространство имён: Tessa.Properties.Resharper
Сборка: Tessa (в Tessa.dll) Версия: 4.1.3+7e2b1422f9b8c7c41fbbc4b151a843bed05319ab
C#
public StringFormatMethodAttribute(
	[InvokerParameterNameAttribute] string formatParameterName
)

Параметры

formatParameterName  String
Specifies which parameter of an annotated method should be treated as format-string

Пример

C#
[StringFormatMethod(nameof(message))]
public void ShowError(string message, params object[] args)
{
  //Do something
}

public void Foo()
{
  ShowError("Failed: {0}"); // Warning: Non-existing argument in format string
}

См. также