Skip to content

Instantly share code, notes, and snippets.

@SMoni
Created May 23, 2024 08:34
Show Gist options
  • Save SMoni/d2c680ee1180365f2b8bc399e9e239c6 to your computer and use it in GitHub Desktop.
Save SMoni/d2c680ee1180365f2b8bc399e9e239c6 to your computer and use it in GitHub Desktop.
public Guid combineThose(Guid[] IDs_) {
const int length = 16;
return IDs_.Aggregate(Guid.Empty, (Accumulate, Current) => {
var result = new byte[length];
var asByteArrayAccumulate = Accumulate.ToByteArray();
var asByteArrayCurrent = Current.ToByteArray();
for (var index = 0; index < length; index++) {
var byteDate = asByteArrayAccumulate[index];
var byteID = asByteArrayCurrent [index];
var byteSurrogate = (byte)(byteID ^ byteDate);
result.SetValue(byteSurrogate, index);
}
return new Guid(result);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment