mono - How to compare arrays for equality in C#? -


in c++, if want check if 2 arrays equal (in terms of content), can do:

#include <vector> #include <cassert>  using namespace std;  int main (int argc, char * const argv[]) {    vector<int> a;   a.push_back(5);    a.push_back(6);   a.push_back(7);    vector<int> b = a;    // copies array a's contents array b    assert( == b );     // compares content of array , b 1 element @ time    return 0; } 

how can achieve same thing in c# without writing own comparison for-loop?

3 links found far, though i'm not sure if outdated:

i'm c# newbie , i'm using mono.

bool equals = array1.orderby(a => a).sequenceequal(array2.orderby(a => a)); 

easy way


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -