Q:

Replace multiple strings with a single sentence

Using ASP.Net and C#, how can I replace multiple string with a single one?
In my code, I use this loop to get the results, but the last argument is the only one filled.
    public void smssend(string CustomerName,string from,string to,string date,string time)
    {
        con.Open();

        string str1 = "select * from Master ";
        SqlCommand command1 = new SqlCommand(str1, con);
        SqlDataReader reader1 = command1.ExecuteReader();
        while (reader1.Read())
        {
            Label1.Text = reader1["Template"].ToString();

        }
        reader1.Close();
        string desc = Label1.Text;
        string[] BadCharacters = { "1", "2", "3", "4","5" };
        string[] GoodCharacters = { CustomerName, from, to, date,time };
        string strReplaced = "";

        int i;
        for(i=0; i<=4; i++)
        {
            strReplaced = desc.Replace(BadCharacters[i], GoodCharacters[i]);

        }
        Label1.Text = strReplaced;

Output:
1 and 2 and 3 and 4 and 12:00:00

How can I concatenate the multiple strings appropriately?

A:

You're  overwriting strReplaced in each loop run.  It seems like you want this instead:
    for(i=0; i<=4; i++)
    {
        desc = desc.Replace(BadCharacters[i], GoodCharacters[i]);
    }
    Label1.Text = desc;

