C# C# Streams and Data Processing Streaming Data on the Net Deserialize the News Results

Leo Ngai
Leo Ngai
2,184 Points

confusing qs

confusing qs

Steven Parker
Steven Parker
182,590 Points

Which question?

This quiz has 3 questions.

3 Answers

Steven Parker
Steven Parker
182,590 Points

Without knowing which question is troubling you, here's some basic hints:

  • the questions all involve putting placeholders in the string for formatting.
  • basic placeholders have the format "{n}" where the n is the placeholder number (starting with 0)
  • special placeholders have the format "{n:f}" where f is a format specifier
Steven Parker
Steven Parker
182,590 Points

While custom formats would work in actual practice, I think the challenge is expecting you to use the standard single-letter format specifiers.

You can find them used in the videos, or in the official MSDN Documentation.

Leo Ngai
Leo Ngai
2,184 Points

Thanks Steven! There are two actually: To fill the blank, the resolution can be a lot but the system does not allow me to pass them (I guess the system is byte-by-byte comparism to its unique answer).

  1. Complete the following code in order to produce a string that prints the current date.

string.Format("The current date is _____________________", DateTime.Now.Date)

i.e. if I fill {0:MM/dd/yy}, it reports error.

  1. Complete the following code in order to produce a string that prints the current date and time, but formatted as a full date/time pattern (short time) like so: "The current date and time is Monday, June 15, 2009 1:45 PM"

string.Format("The current date and time is _____________________", DateTime.Now)

i.e. if I fill {0:dddd, mm yyyy H:mm:ss}, it reports error as well.....

For the first date: string.Format("The current date and time is {0}.", DateTime.Now) For the second string.Format("The current date and time is {0:f}.", DateTime.Now)

Remember for the third question, "I like apples" that the first item is "0" not "1": string.Format("I like {0} and {1}, but I don't like {2}.", "apples", "oranges", "bananas")