Lesson: Override ToString() in Your C# Classes
Technologies: C# and .NET Core
Lesson Description
You should always override the ToString() method in your classes as this will help you when debugging your application. Seeing relevant data immediately in the data tip without having to drill down one more layer and maybe scroll through a complete list of properties should help speed up your development process. In this lesson you learn how to override the ToString() method.
Contents
Introduction 00:00
Prerequisites 00:37
Lesson Objectives 00:42
ToString() Method 00:53
Reasons to Override ToString() 01:10
DEMO: Create a Product Class and Display Default ToString() 01:35
DEMO: Override ToString() 02:28
DEMO: Using an Interpolated String in the ToString() Override 03:06
Best Practices for Overriding ToString() 03:58
Helpful Links
Samples and hands-on labs for this course: https://www.pdsa.com/YouTube
Blog on ToString()
https://www.pdsa.com/Home/BlogPost/35
Object.ToString() Method
https://learn.microsoft.com/en-us/dot...
Override the ToString() Method
https://learn.microsoft.com/en-us/dot...
#csharp #string #tostring #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