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



Yes, of course, those are OOP things, and a static class is basically
just a unit of functions. I don't want to inherit anything. I just
want a ToString() method that is automatically invoked when I append
it to a string. But, for that, I want the inherited method, don't I?

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.

I hope I can possibly explain why I wanted to do such a crazy thing,
it's because there was only one instance of this struct. And it had a
ToString() to easily print out all of its data. So, I made a static
class out of it, instead, which forces only one 'copy' of it. But, I
still wanted a convenient function to print out all of its data. But,
yes, how can object.ToString be invoke on a static class? Thus, I
need to merely make my own function named something else othere than
ToString and use it, instead.

Zytan

.



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)
  • Get an objects value as a string
    ... I am looking for a generic way to see if an object supports the ToString ... then invoke that method to return the results of that generic ... In this exception class I would like to be able to provide a ToString method ... Blog: http://spaces.msn.com/members/rcassick/ ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Making static class ToString() not possible, why?
    ... invoked when you append "it" to a string, but with a static class there ... *isn't* anything to append. ... ToString(), into a static class. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: weird runtime error
    ... System.out.printlnis to invoke the .toString() method on any objects ... The conceptually simplest fix would be to not pass an instance of ... Thakns a lot for the replies! ...
    (comp.lang.java.help)
  • Re: Implement ToString on a method?
    ... > based on a criteria. ... > The user can parse that through, but is it possible to append the ... You can do that already - it ends up calling ToString() on the integer. ...
    (microsoft.public.dotnet.languages.csharp)