Main Site Documentation

Formatted output


#1

I’m new to C# and Fez Panda II and .NET 4.1. In the Microsoft docs I’ve seen references to a string class and formatted strings using notation like:

string output = String.Format(“At {0} in {1}, the temperature was {2} degrees.”,
dat, city, temp);

I can’t seem to make it work.
Is it available?
If not why not?
Any alternative?


#2

String.Format() is not available in NETMF. Why not? Who knows. Alternative? Concatenate like so:


int i = 1234;
string foo = "foo" + i.ToString() + " is the only way";

Note - ToString() is not required in my example, as it is inferred. It is there for readability.

Also, in general, it is helpful to tag your code examples to make them more readable.


#3

Thanks for a very clear and concise - although disappointing - answer.


#4

You might try this code http://netmfcommonext.codeplex.com/ They implement string formatting in a StringUtility class. (Never used it myself)

-Eric