Aller au contenu

Format string and arguments do not match (CA2241)

Ce contenu n’est pas encore disponible dans votre langue.

Key dotnet.codequality.format-arguments · Severity error · Category codequality

Microsoft analyzer CA2241. Flags string.Format and similar calls whose placeholders and arguments do not line up. A missing argument throws FormatException at run time.

var text = string.Format("{0} of {1} items", done);
var text = string.Format("{0} of {1} items", done, total);