my6solutions

asp .net, the social web & other distractions

 

Running Apps

Disclaimer

I am in no way affiliated with Microsoft or Google. I am just another developer trying to make a difference. All opinions and observations are usually my own.

Comparing arrays in C#

There is no native method for comparing arrays in C#. So if you're trying to compare the contents of a byte array and you think Array.Equals() is going to work, you will be surprise. Array.Equals() is only a reference comparison, ie. Object.Equals(). 

You will need to create your own method to compare arrays. However, if you're using Linq, you can use Enumerable.SequenceEqual(). Simple.

 

 

Bookmark and Share

Tags:
Categories: ASP .NET
Permalink | Comments (0) | Post RSSRSS comment feed