What are the original reasons for ToString() in Java and .NET?

后端 未结 4 884
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-06 02:01

I\'ve used ToString() modestly in the past and I\'ve found it very useful in many circumstances. However, my usage of this method would hardly justify to put th

4条回答
  •  伪装坚强ぢ
    2020-12-06 02:42

    Without discussing its merits, I believe this has its roots in the inspirational language for C# - Java. The reason it was created (for both languages) was to provide a way to get a string representation of an instance of any object, including support for different cultures. Simple as that.

提交回复
热议问题