KaraokePC/FirebaseKaraoke/Extensions.cs
Matt Bruce 7cb75f8d5a converted int to Guid for Id properties
Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
2016-07-25 19:18:34 -05:00

22 lines
637 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace FirebaseKaraoke.Extensions
{
public static class StringExtension
{
public static Guid ToGUID(this string input)
{
// Create a new instance of the MD5CryptoServiceProvider object.
MD5 md5Hasher = MD5.Create();
// Convert the input string to a byte array and compute the hash.
byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input));
return new Guid(data);
}
}
}