String concatenation with or without .ToString()?

前端 未结 5 1755
生来不讨喜
生来不讨喜 2020-12-16 23:40

I have a statement where a string is assigned in the following manner:

for (int i = 0; i < x; i++) 
{
    Foo.MyStringProperty = \"Bar_\" + i.ToString();
         


        
5条回答
  •  伪装坚强ぢ
    2020-12-17 00:17

    I would use .ToString() out of habit and readability, I am sure you will find better performance saving elsewhere.

提交回复
热议问题