关于c#中的string和StringBuilder - 什么时候使用?
问题描述:
快速问题。
我正在浏览String vs StringBuilder的文章。我有几个疑问
1.对于不断变化的字符串,最好使用(String或StringBuilder)。请解释原因(我认为它是字符串。如果我错了,请纠正我)
2.对于大字符串这是一个不错的选择(我认为它是StringBuilder)
3.是否优化了字符串类型以接受更改而没有太大影响?
Quick Question.
I am going through the article for String vs StringBuilder. I have couple of doubts
1.Which is better to use ( String or StringBuilder ) for strings that change constantly. Please explain why ( I think it is String. Correct me if I am wrong )
2. For large strings which is a good option ( I think it is StringBuilder )
3.Is string type optimized to accept changes without much impact ?
答
以下文章将清除您的疑虑:
String Vs StringBuilder(C#) [ ^ ]
The following article will clear your doubts:
String Vs StringBuilder (C#)[^]