O'Reilly logo

C# Primer Plus by Klaus Michelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A Method to Perform Array Value Equality Comparisons

Recall our earlier discussion about reference and value equality. Equipped with an understanding for how array object references are passed as arguments to a method, we can now design a method that determines whether two arrays are value equal to each other. The ValueEquals method (lines 21–41) of Listing 10.9 contains this functionality. The Main() method demonstrates how ValueEquals is used. It declares two array variables each referencing different objects, but with identical sets of array elements (lines 7 and 8). The following sample output verifies the difference between value equality as performed by the ValueEquals method, and reference equality performed by the equals comparison operator ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required