GetSeedFromId() public static method

From a generated id - return the seed (i.e. minus the count)
public static GetSeedFromId ( String id ) : String
id String /// A ///
return String
Exemplo n.º 1
0
        /// <summary>
        /// Does a proper compare on the ids
        /// </summary>
        /// <param name="id1">
        /// A <see cref="String"/>
        /// </param>
        /// <param name="id2">
        /// A <see cref="String"/>
        /// </param>
        /// <returns>
        /// A <see cref="System.Int32"/>
        /// </returns>
        public static int Compare(String id1, String id2)
        {
            int result = -1;

            String seed1 = IdGenerator.GetSeedFromId(id1);
            String seed2 = IdGenerator.GetSeedFromId(id2);

            if (seed1 != null && seed2 != null)
            {
                result = seed1.CompareTo(seed2);

                if (result == 0)
                {
                    long count1 = IdGenerator.GetSequenceFromId(id1);
                    long count2 = IdGenerator.GetSequenceFromId(id2);
                    result = (int)(count1 - count2);
                }
            }

            return(result);
        }