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; } } }
@ban_droid3 жыл бұрын
This man woke up, and choose C#
@lukhanyokalashe1906 Жыл бұрын
bro your videos are an amazing help, i would and think other would also appreciate data structure and algorithms in c#
@Cookiebro132 жыл бұрын
super simple and understandable! thx a ton :)
@caseyspaulding2 жыл бұрын
Great
@cabbiechuck Жыл бұрын
I never really understood the ToString method until now!
@StriveforGainz2 жыл бұрын
Thanks for this video!!!
3 жыл бұрын
Thanks Bro!
@neelkamal745410 ай бұрын
ToString() method is defined in base class which is System.Object , System.Object is the ultimate base class for all C# classes.
@spartanranger3 жыл бұрын
Thanks for the video Bro.
@triton54572 жыл бұрын
thx for the vid bro
@MrOmar717 Жыл бұрын
you love corvette very much 😂😂😂😂😂
@qacayjabrayilov472 ай бұрын
wubba lubba dub dub!
@the_dude_josh Жыл бұрын
So what exactly is the point of using the ToString() method? like when would I ever use it?
@whitedinamo3 жыл бұрын
lesson check😊
@definitelynotchris47764 ай бұрын
override
@andrasfejes8988 Жыл бұрын
So there is NO auto generated toStrig() method (with ALL fields), like in JAVA?
@the_dude_josh Жыл бұрын
A random comment down below.
@xoomzera28302 жыл бұрын
but we didnt create virtual tostring wtf
@sametaslantas40922 жыл бұрын
because There is already ToString method in c#
@xoomzera28302 жыл бұрын
@@sametaslantas4092 hehe too late i had to find it alone took me 2 days lmao