Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# console password

var pass = string.Empty;
ConsoleKey key;
do
{
    var keyInfo = Console.ReadKey(intercept: true);
    key = keyInfo.Key;

    if (key == ConsoleKey.Backspace && pass.Length > 0)
    {
        Console.Write(" ");
        pass = pass[0..^1];
    }
    else if (!char.IsControl(keyInfo.KeyChar))
    {
        Console.Write("*");
        pass += keyInfo.KeyChar;
    }
} while (key != ConsoleKey.Enter);
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# do while 
Csharp :: c# multi assignment 
Csharp :: how to cap rigidbody velocity 
Csharp :: get file extension in c# file upload 
Csharp :: c# empty list 
Csharp :: unity interfaces 
Csharp :: c# get foreground window 
Csharp :: csharp read input from console as array 
Csharp :: unity find gameobject with layer 
Csharp :: how to select time and date in datetimepicker in c# 
Csharp :: how to deactivate an object unity 
Csharp :: c# array.join 
Csharp :: how to restart flutter app programmatically 
Csharp :: c# distinct array of objects by values 
Csharp :: remove duplicate characters in a string c# 
Csharp :: c# get battery level 
Csharp :: textblock line break 
Csharp :: c# get custom attribute from property 
Csharp :: if checkbox checked in c# 
Csharp :: c# mongodb get all documents 
Csharp :: how to filter a datatable in c# 
Csharp :: linq query select where c# 
Csharp :: how to minimum text length in textbox in c# 
Csharp :: simple code to call rest api c# 
Csharp :: c# next level script 
Csharp :: how to store some variables on the device in unity 
Csharp :: c# read double 
Csharp :: conditional if statement c# programming 
Csharp :: get domain name from email in asp.net c# 
Csharp :: remove item from list in for loop c# 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =