Every object has its own public override string ToString(){ return string; } method. But we can achieve the same with a custom method. Then why have a separate override string method?
Every object has its own public override string ToString(){ return string; } method. But
Share
If you want to have some string method in your own classes but you do not need this method working on other classes, please, do not EVER use
ToString()for that purpose. It will be a nightmare when you somebody will try to find why some particularToStringmethods are overriden and have smth like :It won’t be easy to guess why cryptic text should be returned here and where it is used. So do not override
ToStringfor production purposes. Only for debugging/testing.