Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C# Structs
#14
Beres Wrote:My question is, what is different about the Convert.ToString() compared to the blah.blah.ToString?
Convert.ToString() is a bunch of functions from the .Net Framework.
.ToString() is a class member function. The thing is that every type in C# already has the implementation of the ToString function, even your custom classes(the default shows the object name, if I remember correctly). The good thing about this is that you can make your own ToString() functions for your custom classes, using the override reserved word.
Code:
public override string ToString()
  {
     return "anything";
  }
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)