Here is a little code that I simplified:
public Boolean Compare(Byte[] a, Byte[] b) { return(a=b); }
Seems like it should work right? Compare each Byte in a with the same Byte position in b and return if the two arrays have equal values in each position? It doesn't do that -- it compares the two objects to see if they are equal. My solution:
public Boolean Compare(Byte[] a, Byte[] b) { if ((a == null) && (b != null)) return (false); if ((a != null) && (b == null)) return (false); if ((a == null) && (b == null)) return (true); if (a.Length != b.Length) return (false); for (int i = 0; i < a.Length; i++) if (a[i] != b[i]) return (false); return (true); }
Is there a better solution?
{6230289B-5BEE-409e-932A-2F01FA407A92}
Remember Me
Powered by: newtelligence dasBlog 2.0.7226.0
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2008, Your Name Here
E-mail