Sign In | Subscribe
Start learning today, and be successful in your academic & professional career. Start Today!
Loading video...
This is a quick preview of the lesson. For full access, please Log In or Sign up.
For more information, please see full course syllabus of C#
  • Discussion

  • Study Guides

  • Table of Contents

Bookmark and Share
Lecture Comments (4)

2 answers

Last reply by: John Snape
Sat Jan 24, 2015 3:22 PM

Post by Thuy Nguyen on September 11, 2014

I hope with all my heart you do an Advanced C# course Professor Snape, thanks to your course I truly begin to see the building looks of computer programming.  

0 answers

Post by Thuy Nguyen on September 11, 2014

Hi, to format a number that's comma separated I typed:  "#,0.00"
With only one # sign followed by a comma.  This works as well.

Formatting Strings for Output

  • {n} where n is a number, is used as a placeholder inside the formatting string
  • {n, x} where x is added for padding, with negative x is left-aligned, positive x is right-aligned
  • .ToString is the default string formatter
  • Formatting numbers uses the form: number.ToString(“xn”) where
    • n is the number of decimal places
    • x is one of the following:
      • C for Currency
      • P for Percentage
      • N for Generic Number
      • F for Floating Point