07:31C# ToString method 💭
From the creator
C# toString() method tutorial example explained #C# #ToString #method using System; namespace MyFirstProgram { class Program { static void Main(string[] args) { //ToString() = converts an object to its string representation so that it is suitable for display Car car = new Car("Chevy", "Corvette", 2022, "blue"); Console.WriteLine(car.ToString()); Console.ReadKey(); } } class Car { String make; String model; int year; String color; public Car(String make, String model, int year, String color) { this.make = make; this.model = model; this.year = year; this.color = color; } public override string ToString() { return "This is a " + make + " " + model; } } }
Published 2021-07-03 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.





