According to the C # documentation:
The
String.Format
method is responsible for converting the value of objects in strings based on the specified formats, and inserts them into another string.
However, I have a question regarding the parameters that are passed to it, this method seems to accept an unlimited amount of parameters, I can pass as many parameters as I want, see example:
class Program
{
static void Main(string[] args)
{
string numeros = string.Format("Numeros: {0}, {1}, {2}.", "Um", "Dois", "Tres");
string nomes = string.Format("Nomes: {0}, {1}, {2}, {3}, {4}, {5}.", "Joao", "Maria", "Junior", "Carvalho", "Leticia", "Silva");
Console.WriteLine(nomes);
Console.WriteLine(numeros);
}
}
In the example the method was invoked with four parameters, the first being the string that will be formatted and the other values that will be entered in string in>, then it was invoked with seven parameters.
My questions are: