r/VisualStudioCode • • Nov 12 '22

Can't get Console.ReadLine() working

Hi I am learning c# and I had setup visual studio code and Jupyter note book.

Everything works fine but today I need to use Console.Readline(). When i start the code it does not stop to read input from keyboard and goes on as the input is null.

I have changed the "console": "integratedTerminal" but it also does not work.

Any help is appreciated.

My code is:

using System;
using System.Collections.Generic;

{ 
Hashtable aileler=new Hashtable(){ 

    {"sipahioğlu","serdar,semra,yağmur,kağan,duru,yılmaz,hadiye"}, 
  
    {"çalışkan","murat,beyra,kerem,deniz"},

    {"makara","yılmaz,yalçın,muradiye"}  };

Console.WriteLine("Soyad giriniz:");

string girdi=Console.ReadLine();

if (aileler.ContainsKey(girdi)){

     Console.WriteLine("Kayıtlı kişiler:"+aileler["girdi"]); } else 

  {
            Console.WriteLine("Kayıt bulunamadı"); }              
  } 
Console.ReadLine();
}
3 Upvotes

2 comments sorted by

View all comments

Show parent comment

1

u/doc415 Nov 12 '22

Spending some time on the topic, I learned how to create new project, build and run from terminal with dotnet command.

It is working without problem in the terminal.

I think i messed up with configuration of script running on the visual studio code.

There are lots of same problem on Google. Begginers like me have problems to enter input with console of the program.

For now i am usint termial to compile the code.