dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]pnetlib development


From: Rhys Weatherley
Subject: Re: [DotGNU]pnetlib development
Date: Wed, 27 Mar 2002 11:37:24 +1000

Daniel Carrera wrote:

> I don't understand the return objA.Equals(objB), but I probably would if I
> knew C#.  Maybe it's there in the event that the user has made his own
> Equals method.  I don't know.

The ECMA specification describes how this method
should work.

Every object has a virtual "Equals(Object obj)" method
for comparing the "this" object against some other object.
Subclasses override this method to provide particular
equality testing algorithms.  Check out classes like
"Int32", "String", and "Version" for examples.

The static "Equals" method wraps this up to provide a
more convenient way of saying "objA is equal to objB",
without having to worry about the "null" cases, or the
common case of objA and objB being the same object.

> I would really like to know exactly what methods will be available from
> the runtime so I can use them when making libraries.  Maybe one of the
> senior members of this list can help me out.

The C# language provides the basics ("if", "while", etc),
and pnetlib provides the rest.  Sometimes it is necessary
to drop down to the runtime engine to perform some task
that cannot be expressed in C# (e.g. Object.GetType).
These facilities are provided with "InternalCall" methods.

These cases are fairly rare.  Most of the time, what you
need is already available in the existing classes.  And the
ECMA specification documents what they should do.

Cheers,

Rhys.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]