Difference Between String and StringBuilder In C#
Автор: CodAffection
Загружено: 2015-08-29
Просмотров: 6834
Описание:
C# tutorial on the difference between string and StringBuilder(string vs StringBuilder).
Main Differences.
1) NameSpace
StringBuilder belongs to System.Text Namespace and that of the string is System.
2) Mutability and Immutability
String is mutable and StringBuilder is immutable.
The mutability of string can be explained as a process for creating new instances when an operation on it changes its value. While StringBuilder does not create new fresh instances like a string instead it overwrite existing instance.
3) Performance
StringBuilder is more efficient than string in c#. Since it doesn't create garbage instances after each operation on it.while in string operation it creates useless intermediate instances.
One Last Point
String won't create new instance all the time.it creates a new instance only when the operation changes its value. So concatenating empty string won't create a new instance.
📂 GitHub Repository
► https://goo.gl/4TgTbj
💖 Buy me a Coffee
➤ https://bit.ly/3L36ut4 (PayPal)
➤ https://bit.ly/3VF0iPT (Razorpay)
🌀 Related Videos
https://goo.gl/iaYpYH : Why .NET String is immutable ?
https://goo.gl/EyfgbN : Code Execution Time in C#.
https://goo.gl/4bSr38 : String Vs string In C#.
🔗 Find me in
Udemy : https://bit.ly/3RtyQSB
Facebook : / codaffection
GitHub : https://github.com/codaffection
Discord : / discord
Twitter : / codaffection
#CSharp #CodAffection
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: