Skip to content

Instantly share code, notes, and snippets.

@JamesMaroney
Created November 28, 2011 19:39
Show Gist options
  • Save JamesMaroney/1401690 to your computer and use it in GitHub Desktop.
Save JamesMaroney/1401690 to your computer and use it in GitHub Desktop.
Guid Combine
public static Guid Combine(params Guid[] guids) {
const int BYTECOUNT = 16;
byte[] destByte = new byte[BYTECOUNT];
var listOfByteArrays = guids.Select(guid => guid.ToByteArray()).ToArray();
for (int i = 0; i < BYTECOUNT; i++) {
destByte[i] = listOfByteArrays.Aggregate<byte[], byte>(0, (current, array) => (byte) (current ^ array[i]));
}
return new Guid(destByte);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment