Exemple #1
0
        // See: http://www.ideablade.com/forum/forum_posts.asp?TID=38&PID=99
        protected virtual string NewGuid()
        {
            var dateBytes = BitConverter.GetBytes(DateTime.Now.Ticks);
            var guidBytes = Guid.NewGuid().ToByteArray();
            // Copy the last six bytes from the date to the last six bytes of the GUID
            Array.Copy(dateBytes, dateBytes.Length - 7, guidBytes, guidBytes.Length - 7, 6);
            var value = new Guid(guidBytes).ToString();

            if (NoDash)
            {
                return value.Replace("-", "");
            }

            return value;
        }
 public static string Generate()
 {
     var guid = new Guid().ToString();
     guid = guid.Replace("-", "");
     return Hash(guid);
 }