Windows运行时应用程序TypeCode

时间:2015-05-12 19:03:40

标签: .net vb.net windows-store-apps

我正在尝试将Scott Guthrie的Basic Dynamic LINQ VB Example移植到 Windows 8.1 Pro 计算机上的 Windows应用商店中。

TypeCode枚举及其相关功能不再可用(来源:MSDN社会帖子标题:“是否从商店和电话8中省略了标准枚举'TypeCode'???”(无法链接,在 .NET for Windows Store应用程序 中没有足够的代表。)

我应该如何最好地翻译此TypeCode比较代码?

来自PromoteExpression()类中的ExpressionParser函数:

Dim value As Object = Nothing

Select Case Type.GetTypeCode(ce.Type)
    Case TypeCode.Int32, TypeCode.UInt32, TypeCode.Int64, TypeCode.UInt64
        value = ParseNumber(text, target)
    Case TypeCode.Double
        If target.Equals(GetType(Decimal)) Then value = ParseNumber(text, target)
    Case TypeCode.String
        value = ParseEnum(text, target)
End Select

If value IsNot Nothing Then Return Expression.Constant(value, type)

(ParseNumber() and ParseEnum() are functions defined in the class.)

1 个答案:

答案 0 :(得分:3)

One option is to change the dependencies { compile 'com.squareup.retrofit:retrofit:1.9.0' compile 'com.squareup.okhttp:okhttp:2.3.0' } block to a set of Select Case statements, and the comparisons from If Else to TypeCode:

GetType