Is there any way to to add custom compile time errors when there is a mismatch in number of arguments passed to String.Format in C#
Eg:
String.Format("{0} and {1} are my pets", animal);
the above line should throw an error since we have passed only one argument "animal"
, while it is expecting two {0},{1}
.. but in reality it throws just run time errors.