c#


The last statement won't run c#! [duplicate]


This question already has an answer here:
Why is the console window closing immediately without displaying my output?
18 answers
Please help! I ran this program and entered all 3 inputs but the last writeline code wouldn't run and the program just exits itself! I have no idea because I follow the book exactly!
string userName = "";
int userAge = 0;
int currentYear = 0;
Console.Write("Please enter your name: ");
userName = Console.ReadLine();
Console.Write("Please enter your age: ");
userAge = Convert.ToInt32(Console.ReadLine());
Console.Write("Please enter the current year: ");
currentYear = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Hello World! My name is {0} and I am {1} years old. I was born in {2}.", userName, userAge, currentYear - userAge);
at the end of the code add:
Console.ReadLine();

Related Links

Unable to order a list using both OrderBy or Sort
Difficulty in defining the filter predicate for a custom Automatically Filtering ComboBox?
C# Regex, any more efficient way to parse string enclosed by symbol?
c# Form freez after try to socket connect
WPF left-click ContextMenu doesn't dissaepear on second click
How to Connect to a Web-service that has a faulty security certificate [duplicate]
How can I get the value from XML return boolean value?
WPF ValidationTemplate doesn't work on DataGridTextColumn
How to control drop down list ?
FileHelpers Tab Delimited Two Headers
Timer stops when some function is called
DataGrid template
Samsung Gear VR - some sounds files fail to play in android device
Zoom into the middle of a panel in C# Winforms
List of distinct items with their count based on another query iterating characters instead of values?
Returning Outlook Mail Item to Client in MVC

Categories

HOME
c#
oop
model-view-controller
azure-documentdb
primefaces
leaflet
virtual-machine
intellisense
popover
squeak
ebay
richtextbox
meson-build
angularjs-ng-repeat
dcos
dynamics-crm-2011
opendaylight
aggregate
hql
google-closure-compiler
game-engine
versioning
filehelpers
mattermost
wai-aria
quality-center
bootstrap-accordion
deployment-descriptor
continuous-fourier
orgchart
gulp-jshint
libxml2
federated
r-factor
textview
jmsserializerbundle
wercker
circle
ports
powerbi-embedded
wunderground
gstreamer-1.0
device-driver
yelp
latency
byobu
mtm
flume-ng
firefox-developer-edition
pexpect
libzip
head
gradlew
api-key
gridgain
line-endings
react.rb
stanford-nlp-server
openidm
dotnet-cli
photoshop-script
overhead
printer-control-language
therubyracer
android-tabs
glade
easy68k
universe
x12
scriptengine
system-integration
aws-kms
paypal-subscriptions
periodic-processing
custom-build-step
firefox-os
computability
sdkman
uinavigationitem
eggplant
eula
web-standards
backtrace
jsonschema2pojo
conditional-comments
dateadd
sigma-grid-control
rssi
new-operator
windows-phone-store
mongoid4
google-oauth-java-client
generator-expression
reference-manual
auctex
microsoft-speech-platform
rbm
boost.build
metapost
yii-components
animationdrawable
umfpack
youtube.net-api
zipstream
norton
newspeak
manuals

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App