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

Invoking WPF Dispatcher with anonymous method
How to make this code DRY?
ManagementScope and Win32_Product retrieving executable paths
Response.Redirect from one web project to another in Visual Studio
Insert rows into Access Table in order from c#
Host TCP Chat Server in IIS
hooks in function argument to accommodate future data?
Change datetime to date in MVC 3 C#
Default state of the systray icon
Help in understanding project euler's question #54
XtraGrid Questions
Add table dynamically in Entity framework in MVC
How i can get the word who user type for a special word in non-english language in any language even c# , javascript
Rich Text box Properties problem
Large dataset in memory - .NET Framework and C#
Entity Framework Code First 0 to 1 mapping

Categories

HOME
azure-documentdb
postgresql-9.3
pelican
display
azure-eventhub
aix
apache-storm
popover
cryengine
redhawksdr
pandoc
sdk
ms-access-2010
foreach
travis-ci-cli
qt4
android-webview
doctrine2
google-api-oauth
phpexcel
ldap-query
captcha
exchange-transport-agents
openstack-horizon
tag-cloud
game-engine
versioning
web-parts
minimagick
dev-c++
multilanguage
visual-studio-debugging
keil
visual-prolog
gitosis
leaderboard
directadmin
bzip2
vpython
qt-quick
android-doze-and-standby
anonymous-function
infovis
pyopenssl
runtime-permissions
px4
jenkins-docker
grib
blackberry
google-scholar
sqlproj
zsh-completion
symantec
dbi
instaparse
django-taggit
treelist
jmap
paypal-subscriptions
jsondoc
github-for-mac
app-data
android-contentresolver
gnu-sort
biginsights
bootstrap-tabs
openhab
tess4j
eaaccessory
fileinputstream
genome
copy-on-write
ultraedit
autopep8
service-broker
launcher
frisby.js
xmlserializer
system.net
powerpoint-2010
ccmenuitem
amzi-prolog
reactjs-native
code-smell
php-amqplib
kohana-orm
android-library
asp.net-4.0
auctex
waveout
facebook-winjs-sdk
automapper-2
mismatch
jexcelapi
noise-reduction
http-response-codes
viewdata
arraycollection
system-analysis
glassfish-embedded
user-preferences
office-2003

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile