C# StreamWriter Write(String, Object, Object)
Description
StreamWriter Write(String, Object, Object)
Writes
a formatted string to the text string or stream, using the same semantics
as the String.Format(String, Object, Object) method.
Syntax
StreamWriter.Write(String, Object, Object)
has the following syntax.
public virtual void Write(
string format,// ww w. j a v a 2s .c om
Object arg0,
Object arg1
)
Parameters
StreamWriter.Write(String, Object, Object)
has the following parameters.
format
- A composite format string (see Remarks).arg0
- The first object to format and write.arg1
- The second object to format and write.
Returns
StreamWriter.Write(String, Object, Object)
method returns
Example
using System;//ww w .j av a 2 s. c om
using System.IO;
using System.Text;
class Program
{
static void Main(string[] args)
{
string fileName = "test.txt";
using (StreamWriter writer = new StreamWriter(fileName))
{
writer.Write("{0} java2s.com {1}",123,345);
}
}
}