Lesson: Use the StringBuilder Class for Efficient String Manipulation in C#
Technologies: C# and .NET Core
Lesson Description
Building strings in memory using the string concatenation operator causes a few problems. The string class is immutable which means that once a string is created in memory, the size and location of this string value cannot grow or shrink. Thus, when you use the concatenation operator you are creating a new string in a new location in memory and telling the .NET garbage collector to throw away the old string value. This causes the garbage collector to perform extra work and slows down your application. This is where using the StringBuilder class can help you out. In this lesson you learn the basics of using the StringBuilder class.
Contents
Introduction 00:00
Prerequisites 00:39
Lesson Objectives 00:45
The StringBuilder Class 01:01
Why StringBulder is More Efficient 01:21
String vs StringBuilder 02:34
DEMO: Instantiating a StringBuilder Class 03:08
DEMO: Initialize a StringBuilder Object with an Initial Capacity 04:21
DEMO: Initialize a StringBuilder Object with an Initial Value 04:59
DEMO: Initialize a StringBuilder Object with an Initial Value and a Capacity 05:32
DEMO: Append Data to the StringBuilder Object Using the Append() Method 05:59
DEMO: Convert a StringBuilder Object to a String Object 07:02
DEMO: Append CR/LF to a StringBuilder Object Using the AppendLine() Method 07:52
DEMO: Format Data Added to a StringBuilder Object Using the AppendFormat() Method 08:38
DEMO: Append a String Array to a StringBuilder Object Using the AppendJoin() Method 10:06
DEMO: Append a Generic Collection to a StringBuilder Object Using the AppendJoin() Method 11:02
DEMO: Search and Replace in a StringBuilder Object Using the Replace() Method 11:52
DEMO: Remove All Data From a StringBuilder Object Using the Clear() Method 12:37
Helpful Links
Samples and hands-on labs for this course: https://www.pdsa.com/YouTube
StringBuilder Class
https://learn.microsoft.com/en-us/dot...
Blog Post on StringBuilder Class
https://www.pdsa.com/Home/BlogPost/136
String Class
https://learn.microsoft.com/en-us/dot...
Composite Format Strings
https://learn.microsoft.com/en-us/dot...
String Interpolation
https://learn.microsoft.com/en-us/dot...
Standard numeric format strings
https://learn.microsoft.com/en-us/dot...
Standard date and time format strings
https://learn.microsoft.com/en-us/dot...
#csharp #string #stringbuilder #stringclass #stringinterpolation #stringformatting #compositestring #dotnet #dotnetcore #pauldsheriff #pdsa #pluralsight #youtube
Paul.About()
Hello, my name is Paul D. Sheriff and I have a passion for teaching. I have been training developers for over 35 years through books, videos, article, blog posts, and international conferences and user groups.
Paul.Contact()
Website: https://www.pdsa.com
Email: [email protected]
LinkedIn: / paulsheriff
Blog: https://blogs.pdsa.com/
Pluralsight: https://app.pluralsight.com/profile/a...
YouTube Channel: @pauldsheriff
Смотрите видео Use the StringBuilder Class for Efficient String Manipulation in C# онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Paul D. Sheriff 14 Март 2024, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 91 раз и оно понравилось 2 людям.