"{0} in c sharp ?"

This is a discussion on "{0} in c sharp ?" within the C# Programming forums, part of the General Programming Boards category; Why We Use {0} in WriteLine Plzz Explain because I have not get any explanation anywhere . Here IS The ...

  1. #1
    vee
    vee is offline
    Registered User vee's Avatar
    Join Date
    Aug 2011
    Posts
    5

    Question "{0} in c sharp ?"

    Why We Use {0} in WriteLine
    Plzz Explain because I have not get any explanation anywhere .
    Here IS The . .


    Code:
    using System;
    public class vee
    {
       public static void Main(string[] args)
       {
          Console.WriteLine("You entered the following {0} command line arguments:",
             args.Length );
          for (int i=0; i < args.Length; i++)
          {
             Console.WriteLine("{0}", args[i]); 
          }
       }
    }

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,639
    Quote Originally Posted by vee
    Plzz Explain because I have not get any explanation anywhere .
    I don't normally like to use this on people, but this one is so hard to believe that... C# console.writeline.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    vee
    vee is offline
    Registered User vee's Avatar
    Join Date
    Aug 2011
    Posts
    5
    Why We use {0} here ?
    Last edited by vee; 08-09-2011 at 09:21 PM.

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,639
    One of the first results from searching the Web is C# Console.WriteLine Use (in fact the first result for me on Google). Have you read the article's "Format strings" section?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    vee
    vee is offline
    Registered User vee's Avatar
    Join Date
    Aug 2011
    Posts
    5
    Ok, SO it means that {0} is working here similarly as in String Format function.

  6. #6
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,604
    It means you did not research it b/c I get about a million hits when typing that into Google.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 46
    Last Post: 08-24-2007, 04:52 PM
  2. "itoa"-"_itoa" , "inp"-"_inp", Why some functions have "
    By L.O.K. in forum Windows Programming
    Replies: 5
    Last Post: 12-08-2002, 07:25 AM
  3. "CWnd"-"HWnd","CBitmap"-"HBitmap"...., What is mean by "
    By L.O.K. in forum Windows Programming
    Replies: 2
    Last Post: 12-04-2002, 06:59 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21