Skip to content

Instantly share code, notes, and snippets.

@tgnm
tgnm / ConvertUnsafeString
Created January 30, 2014 15:37
Convert SecureString to String
public static string ConvertToUnsecureString(this SecureString securePassword)
{
if (securePassword == null)
throw new ArgumentNullException("securePassword");
IntPtr unmanagedString = IntPtr.Zero;
try
{
unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(securePassword);
return Marshal.PtrToStringUni(unmanagedString);
@tgnm
tgnm / platform agnostic view interface
Last active December 21, 2015 12:28
Platform agnostic view interface
public interface ILoginView
{
string Username { get; set; }
string Password { get; set; }
bool RememberMe { get; }
event Action Login();
event Action Exit();
}