Simple.CredentialManager.Credential.Load C# (CSharp) Method

Load() public method

Loads this instance.
public Load ( ) : bool
return bool
        public bool Load()
        {
            CheckNotDisposed();
            UnmanagedCodePermission.Demand();

            IntPtr credPointer;

            var result = NativeMethods.CredRead(Target, Type, 0, out credPointer);
            if (!result)
                return false;

            using (var credentialHandle = new NativeMethods.CriticalCredentialHandle(credPointer))
            {
                LoadInternal(credentialHandle.GetCredential());
            }

            return true;
        }

Usage Example

        private static void WriteSingleCredential()
        {
            var credential = new Credential {Target = "Test"};
            credential.Load();

            Console.WriteLine("User name: {0}, Password: {1}", credential.Username, credential.Password);
        }
All Usage Examples Of Simple.CredentialManager.Credential::Load