SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 442 | Next

Scott Klein

"Professional LINQ"

This class is used
to compare two row values for equality using value-based comparison. It overcomes the need to do
reference comparisons by executing value comparisons on the DataRow itself, enabling you to use this
class against set operators.
Using the DataRowComparer class is preferable to using the GetHashCode and Equals methods because
these operations perform reference comparisons, which is not ideal for set operations over tabular data.
281
Part III: LINQ to SQL
One of the key things to remember about the DataRowComparer class is that it cannot be instantiated
directly. The correct way to use this class is to use the Default property, which returns an instance of
the class. You then use the Equals method to compare two DataRow objects. The two objects are used
as parameters to the Equals method, which returns true if the two rows are equal, and false if they
are not.
This type of comparison is illustrated in the following code. A DataSet is populated, and then two rows
are identified for comparison. An instance of the DataRowComparer is then created, at which point the
Equals method is called, passing the two rows as parameters for comparison.


Pages:
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6