Atlanta Custom Software Development 

   Search        Code/Page

User Login



Forgot the Password?
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
» Regular Expr Tester
» Free Tools

The standard way to test whether two object variables point to the same object is through the Is operator, as in:

Click here to copy the following block
If obj1 Is obj2 Then ...

However, when both object are of the same type, or point to the same secondary interface, you can slightly optimize your code by testing whether the values returned by the ObjPtr() function match:

Click here to copy the following block
If ObjPtr(obj1) = ObjPtr(obj2) Then ...

This second line of code is about 40% faster than the Is operator. However, both statements are so efficient that you should perceive a difference only if the comparison is inside a time-critical loop that is executed some hundreds thousand times.

Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with, SQL Server and other MS technologies. He is, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )

Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.