Hai all...
Consider a sample database like this
Source IP Protocol
204.71.200.244 LLC
135.8.60.182 LOOP
204.71.200.244 LLC
172.16.115.5 LLC
each value i am getting as an abject using Dataset datatable concepts...
if i compare object
source1=204.71.200.244 and object source3= 204.71.200.244
I am getting a false value.....
Similarly for
object proto3=LLC and object proto4=LLC...
Help me please.....
Loading
Guest UserPosted Dec 16, 2008, 10:19 AM
In your example, object1 will never be equal to object3 because they are referring to two different data objects, even though their contents are the same. In my example, the "ToString()" methods return the string equivalent of each object, and then I use the "Equals()" method to compare them.
If you're new to OOP, then the difference between objects and values can sometimes be a difficult concept to grasp, but keep at it! You'll get it soon enough.
Posted Dec 15, 2008, 11:59 PM
Guest UserPosted Dec 15, 2008, 5:03 PM
You need to use something like object1.ToString().Equals(object3.ToString()).