Replace multiple words in string

后端 未结 8 1118
独厮守ぢ
独厮守ぢ 2020-12-18 19:02

I have multiple words I want to replace with values, whats the best way to do this?

Example: This is what I have done but it feels and looks so wrong



        
8条回答
  •  死守一世寂寞
    2020-12-18 19:35

    Improving on what @Evan said...

    string s ="Dear , your booking is confirmed for the ";
    
    string s1 = client.FullName;
    string s2 = event.EventDate.ToString();
    
    txtMessage.Text = s.Replace("", s1).Replace("EventDate", s2);
    

提交回复
热议问题