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

Is this good practice for a Custom Exception?
Dynamically generate property getter/setter through reflection or similar
Ascending List Permutation
Getting Control level (view) validation errors back to the View Model
Displaying multiple pieces of information from a combobox selection?
Taskpool system for .NET
C# Remove padding from TabPages in Windows Forms
Serialization .txt vs .xml
Getting an image from an RSS feed, using syndication?
Modifying or replacing column values reading from the DataTable
Best Practices for Lookup Tables in EF Code-First
Reading cookie in c#
rounding decimal to special number of digits
Debugging assembly load issue in C#
The process cannot access the file '' because it is being used by another process
Subscribing to COM events in managed COM assembly from C#

Categories

HOME
oauth-2.0
python-requests
salesforce-lightning
lithium
pandoc
perl6
procmon
pyodbc
rename
core-data
osrm
chef-recipe
browsermob
opengrok
repeater
opendaylight
greensock
windows-phone
android-actionbar
single-page-application
openoffice-basic
datasource
webgl-earth
ppp
pydub
request-uri
login-required
loopback
choco
favorites
keychain
html-entities
chrome-custom-tabs
android-doze-and-standby
text-formatting
critical-section
mac-app-store
indoor-positioning-system
dbi
x12
shtml
salesforce-service-cloud
github-for-mac
controlpanel
skscene
mojolicious
biginsights
transport
lytro
consul-template
joomla3.3
grails-3.0.9
system.diagnostics
pymol
nexusdb
qf-test
growl
indic
atg-dynamo
sendy
codio
mdp
vbaccelerator
logo-lang
mobile-robots
ie-developer-tools
kendo-window
zend-db-table
nsnumber
panelgrid
gpl
django-tinymce
dancer
socketasynceventargs
eeprom
utm
umfpack
clgeocoder
httppostedfilebase
parallel-python
coderush-xpress
managed-code
moores-law

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App