MikeyJY
Member
- Joined
- Sep 19, 2021
- Messages
- 11
- Programming Experience
- 5-10
I want to get the pressed key to a char, without importing System.Windows.Forms. It is not a forms app, just a console app. Preferable with an event:
C#:
using System;
using System.Collections;
public class Program{
List<char> Keys = new List<char>();
//hypothetical
public override void AnyKeyPressed(System.Windows.Input Key key){
Keys.Add(key.ToChar());
}
public static void main(string[] args){
for(int i = 0;i<Keys.Count();i++){
Console.Write(Keys.ElementAt(i) + " ");
}
}
}
Last edited: