Created
November 28, 2011 19:39
-
-
Save JamesMaroney/1401690 to your computer and use it in GitHub Desktop.
Guid Combine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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