Create Unique ID With Base64 - CSharp System

CSharp examples for System:String Base64

Description

Create Unique ID With Base64

Demo Code


using System.Web;
using System.Text.RegularExpressions;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;//from  w w  w  . ja v  a  2  s.c  o m

public class Main{
        public static string CreateUniqueIDWithBase64()
        {
            Guid id = Guid.NewGuid();
            DateTime begin = new DateTime(2013, 9, 1);
            TimeSpan ts = DateTime.Now - begin;
            string s = (int)ts.TotalMinutes + Convert.ToBase64String(id.ToByteArray()).Replace("+", "!").Replace("/", "$");
            return s;
        }
}

Related Tutorials