I want to override the Tostring() method for changing some characters. Is it possible? If yes, How can I do this?
I want to override the Tostring() method for changing some characters. Is it possible?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As per your question, to change some characters in the
ToStringimplementation, you need to call the existingToStringmethod by using thebasekeyword:Note that if you forget the
basekeyword it will call itself repeatedly until you get aStackOverflowException.