Re: Get name of instance of object

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Joanna Carter [TeamB] wrote:
"Jon Slaughter" <Jon_Slaughter@xxxxxxxxxxx> a écrit dans le message de news: 12iisgmj7i0hg29@xxxxxxxxxxxxxxxxxxxxx
| and it does this for references to these instances inside a string? I don't
| think so? The whole point is to make things make sense. I'm not trying to
| get something at runtime or in an assembly but to turn a variables name into
| text so I can display this at runtime. This is a similar idea to using
| enums.

I suggest that you are trying to do something that is not normal in other languages as well in C#. In over ten years, I certainly have never found a need to do what you are suggesting. If you really want to continue with this unusual quest, then I suggest you use straightforward search and replace in your source files to achieve any possible refactoring.

As someone has already mentioned, then it is possible via
the C/C++ preprocesser.

And it seen used occasionally. Not often but it happens.

It is not possible in current C#. And I doubt that it
will be possible in any of the future versions of C#.

It does not really fit well with the C# model.

Arne
.



Relevant Pages

  • Re: Diamondback new features for Win32
    ... Joanna Carter wrote: ... The garbage file you leave behind. ... The references to that unit aren't updated. ... And you belong to the TeamB? ...
    (borland.public.delphi.non-technical)
  • Re: Getting file name from the file path error
    ... I checked one users tools - References and it appears that it ... It is part of a code module in an Excel ... end of statement with the As highlighted after the(stFullName As String). ... Sub GetFileNameAs String ...
    (microsoft.public.excel.programming)
  • Re: accessors
    ... mentioned that returning references from functions makes using ... boundaries, but if i did, "string const& nameconst" is functionally ... the same as "string nameconst", so i don't see why i'd have to change ... anything (but if i did, the change does not really affect client code, ...
    (comp.lang.cpp)
  • Re: Importing Excel
    ... Function LastInStr(strSearched As String, strSought As String) As Integer ... Didn't realize you haven't set references yet. ... > named Microsoft Excel and select the box. ...
    (comp.databases.ms-access)
  • Re: Is garbage collection here yet?
    ... I don't consider tcl to be a fully higher-level language. ... Tcl has so many other cool features and such a clean ... As others have answered, Tcl does do ref-counting GC of its values, which works fine for strings as they can't contain circular references and are stateless/immutable. ... Basically, it's hard to distinguish a reference from any other string, which makes it difficult to know when it is safe to delete something. ...
    (comp.lang.tcl)