2 using System.Diagnostics.Contracts;
4 namespace System.Globalization {
7 public sealed class SortVersion : IEquatable<SortVersion> {
9 private int m_NlsVersion;
10 private Guid m_SortId;
12 public int FullVersion {
24 public SortVersion(int fullVersion, Guid sortId) {
26 m_NlsVersion = fullVersion;
29 internal SortVersion(int nlsVersion, int effectiveId, Guid customVersion) {
30 m_NlsVersion = nlsVersion;
32 if(customVersion == Guid.Empty) {
34 byte[] b = BitConverter.GetBytes(effectiveId);
36 byte b1 = (byte) ((uint) effectiveId >> 24);
37 byte b2 = (byte) ((effectiveId & 0x00FF0000) >> 16);
38 byte b3 = (byte) ((effectiveId & 0x0000FF00) >> 8);
39 byte b4 = (byte) (effectiveId & 0xFF);
40 customVersion = new Guid(0,0,0,0,0,0,0,b1,b2,b3,b4);
43 m_SortId = customVersion;
46 public override bool Equals(object obj) {
47 SortVersion n = obj as SortVersion;
49 return this.Equals(n);
55 public bool Equals(SortVersion other) {
60 return m_NlsVersion == other.m_NlsVersion && m_SortId == other.m_SortId;
63 public override int GetHashCode() {
64 return m_NlsVersion * 7 | m_SortId.GetHashCode();
67 public static bool operator ==(SortVersion left, SortVersion right) {
68 if (((object) left) != null) {
69 return left.Equals(right);
72 if (((object) right) != null) {
73 return right.Equals(left);
80 public static bool operator !=(SortVersion left, SortVersion right) {
81 return !(left == right);