Class 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(IFormat
Implements
Inherited Members
Namespace: JetBrains.Annotations
Assembly: UnityEngine.dll
Syntax
[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class StringFormatMethodAttribute : Attribute, _Attribute
Examples
[StringFormatMethod("message")]
public void ShowError(string message, params object[] args) { /* do something */ }
public void Foo() {
ShowError("Failed: {0}"); // Warning: Non-existing argument in format string
}
Constructors
| Improve this Doc View SourceStringFormatMethodAttribute(String)
Declaration
public StringFormatMethodAttribute(string formatParameterName)
Parameters
Type | Name | Description |
---|---|---|
String | formatParameterName | Specifies which parameter of an annotated method should be treated as format-string |
Properties
| Improve this Doc View SourceFormatParameterName
Declaration
public string FormatParameterName { get; }
Property Value
Type | Description |
---|---|
String |