Pointer Comparision

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I know this should be simple but I can't find it.

Dim A as new object
Dim B as object
B = A

Do Bunch of stuff

Check if B still = A

This is basically pointer comparision in C++ days. how do I check that
A and B still point to the same object?

Chris
 
I said:
I know this should be simple but I can't find it.

Dim A as new object
Dim B as object
B = A

Do Bunch of stuff

Check if B still = A

This is basically pointer comparision in C++ days. how do I check that
A and B still point to the same object?

Chris

I knew I knew it.

If B is A then

end if

Chris
 
I Don't Like Spam said:
Dim A as new object
Dim B as object
B = A

Do Bunch of stuff

Check if B still = A

This is basically pointer comparision in C++ days. how do I check that A
and B still point to the same object?

While the '=' operator is used to assign references, the 'Is' operator is
used to test for object identity (reference equality):

\\\

' Check for reference-equality.
If A Is B Then...

' Check for reference-inequality.
If Not A Is B Then...
If A IsNot B Then... ' VB 2005 only!
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top