#27 Overriding ToString - C# Tutorials for Beginners | CoffeeNCode

preview_player
Показать описание
How to override ToString to make better functioning classes in Visual Studio using C#!
💖 Become a Patron: Show support & get perks!

💻 Community Discord server
When you join the server, you can get your own personal help channel for FREE where you can post anything you're stuck with and I will help you 😊

☕ Buy me a Coffee

Overriding the ToString method can open your code up to different use cases, its stops the use for another function just to print details about a certain class. You can create shorter outputs to the screen by making sure you override ToString which will let you specify your own return like in the video you can display the details about a Person without having to write another function.

Theory aside, they are used to make your code a lot smaller and neater to read when you are doing something simple and it can help the readability and maintainability of your code when others or you (in the future) reads it again!

📣 Socials

Timestamps:
0:00 Intro
0:25 Examples
3:50 ToString refactor
5:45 Recap
7:33 Outro & Patreon shoutout
Рекомендации по теме
Комментарии
Автор

💪🏼 Udemy C# Masterclass course, 83% off sale ends soon! ⬇

💻 Need free programming help? Join our community Discord server!

CoffeeNCode
Автор

how can you override a List with the ToString method?

manuelalbarran
Автор

can we write int variables in to our override tostring method?

sametaslantas