[英]how can I make a uint32 in F#?
I have an .NET api, from RabbitMQ, that takes a uint32我有一个来自 RabbitMQ 的 .NET api,它需要一个 uint32
the method is:方法是:
void BasicQos(uint prefetchSize, ushort prefetchCount, bool global);
in C#:在 C# 中:
channel.BasicQos(0, 1, false);
but in F#, the same line gives:但在 F# 中,同一行给出:
[FS0001] This expression was expected to have type 'uint32' but here has type 'int' [FS0001] 此表达式的类型应为“uint32”,但此处的类型为“int”
but I can't figure out how to declare a number as unsigned in F#;但我不知道如何在 F# 中将数字声明为无符号数; how can I do this?我怎样才能做到这一点?
UInt32 and UInt32Converter exist but I couldn't see how I could use them to convert / cast, etc. UInt32 和 UInt32Converter 存在,但我看不到如何使用它们进行转换/转换等。
Check out the docs page on literals here , but the short form is that you need the u
suffix: 0u
is an unsigned 32-bit integral zero.在此处查看有关文字的文档页面,但简短的形式是您需要u
后缀: 0u
是无符号的 32 位整数零。 You could also use the uint32
function to convert a signed 32-bit int to an unsigned 32-bit int, but this would be work done at runtime as opposed to a compile-time value.您还可以使用uint32
函数将有符号 32 位 int 转换为无符号 32 位 int,但这将在运行时完成,而不是编译时值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.