20

I sincerely like the moment, when i train a newbie to code .NET showing him/her how far OOP in .NET goes.

I love to give the following example:
var s = "round and round it goes";
s = s.ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString();

And yeah. It's totally fine.
Because each component of .NET is inherited of object. And the class object supports you with the function "ToString()".

After that, in most of the cases, i get a slightly irritated look from the newbie.
Than i say, "welcome to Microsoft" ;)
I finally add, that the compiler of .NET finally identifies duplicate results and refactores the given code before execution ^^

Coding Is fun, as long as you get the big picture/concept of the language you're using.

Comments
  • 0
    You could have stopped at:

    s = s.ToString().ToString();

    😂
  • 1
    @tocttou
    "Yeah..... i could....".ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString();

    But i didn't want to xD
Add Comment