473,480 Members | 1,836 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

difference

If i write:

double alfa = 10;

Console.WriteLine("The number is {0}", alfa");

it shows on the console: The number is 10.

Now, what the meaning if i write:
Console.WriteLine("The number is {0:xx}", alfa") ?

I know it's incorrect, i just can't figure out what does the colon and
the parameter xx may mean.

Thanks

Sep 11 '07 #1
2 1129
Hi,

Both lines will giv eyou error, there is an extra " at the end.

Take a look at formatting in MSDN. It can get tricky at the beginning and
the best way to get it is seeing examples.

"vinnie" <ce**********@gmail.comwrote in message
news:11**********************@r34g2000hsd.googlegr oups.com...
If i write:

double alfa = 10;

Console.WriteLine("The number is {0}", alfa");

it shows on the console: The number is 10.

Now, what the meaning if i write:
Console.WriteLine("The number is {0:xx}", alfa") ?

I know it's incorrect, i just can't figure out what does the colon and
the parameter xx may mean.

Thanks

Sep 11 '07 #2
vinnie wrote:
If i write:

double alfa = 10;

Console.WriteLine("The number is {0}", alfa");

it shows on the console: The number is 10.

Now, what the meaning if i write:
Console.WriteLine("The number is {0:xx}", alfa") ?

I know it's incorrect, i just can't figure out what does the colon and
the parameter xx may mean.

Thanks
The string that comes after the colon is a formatting string. You can
for example use {0:N2}, which would format the number with two decimal
places.

Formatting overview:
http://msdn2.microsoft.com/en-us/library/26etazsy.aspx

--
Göran Andersson
_____
http://www.guffa.com
Sep 11 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

34
7024
by: yensao | last post by:
Hi, I have a hard time to understand difference and similarities between Relational database model and the Object-Oriented model. Can somebody help me with this? Thank you in advance. ...
21
2961
by: b83503104 | last post by:
Hi, Can someone tell me the difference between single quote and double quote? Thanks
26
4369
by: Frank | last post by:
For my website i would like to display the age of my son in years, months, days and hours. For now i manage to get a result for totals. Like the total number of days. This is the beginning: ...
21
2811
by: Rich | last post by:
I was considering C# for developing a scientific application, but I have noticed a ~30% difference between VC++ .NET and C# on the same machine, under identical conditions: double a = 0,b = 0, c...
4
15649
by: jamesyreid | last post by:
Hi, I'm really sorry to post this as I know it must have been asked countless times before, but I can't find an answer anywhere. Does anyone have a snippet of JavaScript code I could borrow...
3
4137
by: bbawa1 | last post by:
Hi, I have a table which has a field ItemsReceived of type datetime. I have a grid view which has two columns. In first column i have to show the data from field ItemsReceived and in second...
12
2693
by: Petronius | last post by:
Hallo, does anyone have an idea how to implement difference lists in Javascript? Thanks allot in advance
5
3473
by: Julius | last post by:
Hej dudes, I need to calc the difference between two timestamps / dates ... For example what i need to calculate: Date 1: 2007.11.06 - 20:13:04 Date 2: 2007.11.07 - 21:13:04 Difference:...
9
2658
by: viki1967 | last post by:
Hi all! This new forum its great! :) Congratulations !!! My answer: why this my code not working? Nothing error but not work the difference.... : <html>
11
12085
by: cmb3587 | last post by:
I have two arrays and I'm trying to create a 3rd array that is the difference between the two arrays Ex: arrayA: 3 5 8 9 arrayB: 3 4 6 9 difference of A-B: 5 8 however, my...
0
7054
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6918
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7057
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7102
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6756
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4798
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1310
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
570
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
199
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.