Tostring()
Tostring() method is deive from which class?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Sam HobbsRank #108 · 20.5K reputationPosted Aug 1, 2010, 9:48 AM EDT
Roy S194 reputationPosted Aug 1, 2010, 11:21 AM EDT
http://msdn.microsoft.com/en-us/library/system.object.tostring%28VS.80%29.aspx
Sam HobbsRank #108 · 20.5K reputationPosted Aug 1, 2010, 12:19 PM EDT
Please understand that ToString is derived from nothing; it is a method, and methods are not derived; not ever. Saying that ToString is derived from System.Object can make a beginner very confused. ToString is a member of System.Object.
Roy S194 reputationPosted Aug 1, 2010, 12:32 PM EDT
1) If a class is derived from another, then the child class has all the members that the parent class has (and its own).
2) All classes (and other things maybe?) are derived from the object class (which has that ToString() method).
3) I thought that his question was 'from which class comes the ToString() method?' so knowing all of that I think the answer is from the object class.
If something is wrong then tell me. Maybe I got the wrong idea of what 'to derive' is?
Sam HobbsRank #108 · 20.5K reputationPosted Aug 1, 2010, 1:12 PM EDT
2) Yes, all .Net classes are derived from System.Object, either directly or indirectly. Value types (structures) are derived from the ValueType Class which is derived from the Object class.
3) No. The question is not "'from which class comes the ToString() method". Please read the question again. The word "comes" is vague and has no specific meaning in this context but the term "derives" is very specific in this context.
Roy S194 reputationPosted Aug 1, 2010, 1:42 PM EDT
I didn't stood still thinking about that 'mistake' and answered the question he probably meant to ask and not what literally was said in the post. I don't want to be rude or anything but you kinda sound like a computer, shouting 'syntax error'. Maybe next time you could add a little extra to your post like:
[what's wrong with question]
[what he probably meant] + [answer to that]
Sam HobbsRank #108 · 20.5K reputationPosted Aug 1, 2010, 2:38 PM EDT
People that voluntarily attempt to help others see many vague questions and questions written carelessly. I often spend more time asking for clarification than the person spent asking the question. Use of the correct terminology can be critical. It is okay to guess what the person means except if you guess wrong it might be better to not answer. I think it is important to always make it clear that you are guessing when you guess; I do. So note that I expected the person asking the question to clarify the question or something such as that. Instead I spend a lot of time clarifying what you said because you tried to guess what the person meant. I would have preferred that the person asking the question ask for clarification.
Note that your original answer could cause a beginner to be very confused. As I said, the term derived has a very specific meaning in this context.