Which methods in the 3.5 framework have a String.Format-like signature?
.net-3.5, c#, string
Solution
There are a lot of methods that support this throughout the framework. All subclasses of TextWriter (and therefore StreamWriter and StringWriter and their subclasses) will inherit the Write method that supports this.
Another example that is often used is StringBuilder.AppendFormat.
You can write your own methods to support this too. You can do it by having an overload with a format string parameter and another parameter with the `params` keyword, like this:
public void Foo(string message) {
// whatever
}
public void Foo(string format, params string[] arg) {
Foo(string.Format(format, arg));
}
Problem
I just noticed that I can do the following, which came as a complete surprise to me: ``` Console.WriteLine("{0}:{1}:{2}", "foo", "bar", "baz"); ``` This works for the `Write` method too. What other methods have signatures supporting this, without requiring the use of `String.Format`? `Debug.WriteLine` doesn't... `HttpResponse.WriteLine` doesn't... (And on a side note, I could not find a quick way of searching for this with Reflector. What is a good way to search for specific signatures?) Edit: Specifically for the 3.5 framework.