Re: Making static class ToString() not possible, why?



But what's the "it" here? You say you want it to be automatically
invoked when you append "it" to a string, but with a static class there
*isn't* anything to append. That's the problem.

LOL!

This scenario came about from me converting a struct which overrode
ToString(), into a static class. Everything converted over fine,
except the ToString(), which is used only for debugging purposes, so
it's not a big issue. I am just curious about it.

Hope that's cleared things up for you.

Yes, you have! :)

Thanks, Jon.

.



Relevant Pages

  • Re: Making static class ToString() not possible, why?
    ... Yes, of course, those are OOP things, and a static class is basically ... invoked when you append "it" to a string, but with a static class there ... ToString(), into a static class. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: StringBuffer/StringBuilder efficiency
    ... The main effect of that is that you can append things like StringBuffers and CharBuffers directly, without having to toString them. ... Appending something that is not a CharSequence would capture its toStringresult as of the time of the append. ... If this was python, i'd think about modifying appended StringBuilders at runtime to intercept any attempts to modify them, to run a hook which would copy the original contents to a string for appending purposes before removing the interception code and carrying on with the append, but fortunately, such madness is not possible in java. ...
    (comp.lang.java.programmer)
  • Re: Making static class ToString() not possible, why?
    ... I don't want to inherit anything. ... invoked when you append "it" to a string, but with a static class there ... ToString() to easily print out all of its data. ... how can object.ToString be invoke on a static class? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Making static class ToString() not possible, why?
    ... Yes, of course, those are OOP things, and a static class is basically ... But, for that, I want the inherited method, don't I? ... This scenario came about from me converting a struct which overrode ... ToString(), into a static class. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: StringBuffer/StringBuilder efficiency
    ... append and toString. ... Consider that server side code is mostly just ... I began to think of children not as immature adults, ...
    (comp.lang.java.programmer)