F#NumericLiteral:FromString方法

F#NumericLiteral:FromString方法,f#,F#,有人知道有没有办法自动调用F#中数值文本的FromString方法?我已经尝试过(并成功地)使用FromOne、FromZero等方法,但我不知道如何在编译时处理字符串…来自: xxxx 对于xxxx=0->NumericLiteral.FromZero() 对于xxxx=1->NumericLiteral.FromOne() 对于Int32范围内的xxxx->NumericLiteral.FromInt32(xxxx) 对于Int64范围内的xxxx->NumericLiteral.FromI

有人知道有没有办法自动调用F#中数值文本的FromString方法?我已经尝试过(并成功地)使用FromOne、FromZero等方法,但我不知道如何在编译时处理字符串…

来自:

xxxx
对于xxxx=0->NumericLiteral.FromZero()
对于xxxx=1->NumericLiteral.FromOne()
对于Int32范围内的xxxx->NumericLiteral.FromInt32(xxxx)
对于Int64范围内的xxxx->NumericLiteral.FromInt64(xxxx)
对于其他数字->NumericLiteral.FromString(“xxxx”)
这意味着,只有在不满足前4个条件时,才会调用
FromString
。另外,
xxxx
必须是带符号的数字,您不能为xxxx使用其他alphabeta设置

摘自本手册第51页:

xxxx
对于xxxx=0->NumericLiteral.FromZero()
对于xxxx=1->NumericLiteral.FromOne()
对于Int32范围内的xxxx->NumericLiteral.FromInt32(xxxx)
对于Int64范围内的xxxx->NumericLiteral.FromInt64(xxxx)
对于其他数字->NumericLiteral.FromString(“xxxx”)

这意味着,只有在不满足前4个条件时,才会调用
FromString
。另外,
xxxx
必须是带符号的数字,您不能为xxxx使用其他alphabeta设置

我想它是为大于Int64.MaxValue的数字设计的。

我想它是为大于Int64.MaxValue的数字设计的。

真遗憾!我已经在想我的下一个内联语言:)真遗憾!我已经在想我的下一种内联语言:)
xxxx<suffix>
For xxxx = 0 -> NumericLiteral<suffix>.FromZero()
For xxxx = 1 -> NumericLiteral<suffix>.FromOne()
For xxxx in the Int32 range -> NumericLiteral<suffix>.FromInt32(xxxx)
For xxxx in the Int64 range -> NumericLiteral<suffix>.FromInt64(xxxx)
For other numbers -> NumericLiteral<suffix>.FromString("xxxx")