public string ToString(string format, IFormatProvider formatProvider) { switch (format) { case null: case "N": return(ToString()); case "I": return(Id.ToString()); case "NA": return(Name); case "PC": return(PeopleCount.ToString()); case "B": return(Birthyear.ToString()); case "ID": return(IsDead.ToString()); case "C": return(Country); case "All": return(String.Format("#ID:{0}\tName:{1}\tPeople Count:{2}\tBirthyear:{3}\tIsDead:{4}\tCountry:{5}", Id, Name, PeopleCount, Birthyear, IsDead, Country)); default: throw new FormatException(String.Format("Format {0} not supported", format)); } }
private string GetMd5Hash() { var fields = string.Concat( Code, PeopleCount.ToString(), ChameleonCount.ToString(), State, Character, TimeToPollMillisecond.ToString() ); var inputBytes = Encoding.ASCII.GetBytes(fields); return(MD5.Create() .ComputeHash(inputBytes) .Select(x => x.ToString("X2")) .Concat()); }