converting letter to ascii

C#
// This Example is from delphi 10.3 comunity edition
// and it is a TButton on click event(Can be used with other events)
//converts letters Uppercase and lowercase to their corresponding ASCII values 
procedure TForm1.btntoasciiClick(Sender: TObject);
var
  cletter : char;              //you can name your variables anything
  Alphabet : set of char;      //you like within reason
begin
  cletter := edtlet.Text[1];       //edtlet was the TEdit i was using
  Alphabet := ['A'..'Z','a'..'z'];
  
  if cletter in Alphabet then
    begin
      edtnum.Text := IntToStr(Ord(cletter)); //I was using a TEdit as the output but you can use a memo  
    end else ShowMessage('<What you want to say>');	//or another form of text output
end;
Source

Also in C#: