locked
sprintf() equivalent in C# RRS feed

  • Question

  • C++:

    sprintf(formattedDate, "%02d/%02d/%02d", Month, Day, Year);

    C#:

    public char[] formattedDate = new char[255];
    public int Month;
    public int Day;
    public int Year;

    string.Format(formattedDate, "%02d/%02d/%02d", Month, Day, Year);

    I tried the above C# code but it throws error. Need a fix.

    Monday, February 23, 2015 7:32 AM

Answers

All replies