Re: Distinguishing between one instance object to another instance

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Stu Smith (stuarts_at_nospam-digita.com)
Date: 09/07/04


Date: Tue, 7 Sep 2004 12:24:36 +0100

You could add a property to your base class, which evaluates
base.GetHashCode() (ie the Object one) and returns that value.

"Nadav" <Nadav@discussions.microsoft.com> wrote in message
news:80C9C56E-BFD7-4AFD-B248-2B88FA8B75BD@microsoft.com...
> Yess, thats true, BUT for me it is the same as calling
object.GetHashCode(),
> I still would have to call a function rather then evaluate a property,
> evaluating a property can be done while debugging through the watch
views...
> while calling a function is less intuitive...
>
> "Peter Rilling" wrote:
>
> > Are you talking about determining if two instances point to the same
object?
> > If so, you could use Object.ReferenceEquals(...).
> >
> > "Nadav" <Nadav@discussions.microsoft.com> wrote in message
> > news:65975E35-03EA-4C41-B889-C13FB7F09EA7@microsoft.com...
> > > Hi,
> > >
> > > Introduction:
> > > *********
> > > I have a program that manage a pool of objects of the same type, while
> > > debugging I set a breakpoint in one of the methods of that type
> > >
> > > The problem:
> > > **********
> > > I didn't find a way of distinguishing between one object and the
other, in
> > > C++ it is possible to distinguish between one object to the other
> > > according
> > > to the 'this' address... as safe managed code doesn't support pointers
I
> > > cannot do that in safe C#, it is possible to use the GetHashCode
method
> > > BUT
> > > as this is a method ( and not a property ) it would have to be
executed
> > > through the 'command' window which makes it not so convinient...
> > >
> > > SOoooo... Is there any other way to distinguish between one object to
the
> > > other using 'safe' managed code?
> > > --
> > > Nadav
> > > http://www.ddevel.com
> >
> >
> >



Relevant Pages

  • Re: delete this
    ... static flag member of the class which is cleared just before calling the ... base class CDialog::PostNcDestroyand set by the derived destructor. ... void CDgSplashPanel::PostNcDestroy ...
    (microsoft.public.vc.language)
  • Re: ComboBox Behavior in DropDownList
    ... You may also try to override it's "OnKeyPress" member, and set it to true before calling the base class' procedure. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Storing records from a parsed file
    ... don't see why I can get away with calling it without reference to a ... base class - for a start how does it know whivh one to call... ...
    (comp.lang.python)
  • Re: Accessing mangled class attrbutes
    ... Steve Juranich wrote: ... There is no method '__write' in the base class, ... Make sure you're calling the super's constructor before you try and access ...
    (comp.lang.python)