There is no TypeConverter class in the WinRT and the team has not announced any plans to include it in a future release. You have a number of options.
Option 1: If the conversion is to be done as part of a data binding use the IValueConverter interface as Dennis mentioned.
Option 2: If you are the creator of the type you can add your own explicit or implicit operators to support casting:
http://msdn.microsoft.com/en-US/library/xhbhezf4(v=vs.80).aspx
http://msdn.microsoft.com/en-US/library/z5z9kes2(v=vs.80).aspx
Option 3: You could create your own TypeConverter class.
Option 4: (The way I'd do it if not part of a binding) You can add your own extension methods:
static public class ConverterExtensions
{
static public string ToFixedString(this double value)
{
return value.ToString("D");
}
}
Which would let you write code like this:
double d = 123.45;
string str = d.ToFixedString(); // str now equals "123"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…