Does C# have an Unsigned Double?

后端 未结 4 692
忘掉有多难
忘掉有多难 2020-12-20 11:14

I need to use an unsigned double but it turns out C# does not provide such a type.

Does anyone know why?

4条回答
  •  星月不相逢
    2020-12-20 11:43

    There is no such thing as an unsigned double in any language or system that I have ever heard of.

    I need to give the ability to pass a variable that can be a fraction and must be positive. I wanted to use it in my Function signature to enforce it.

    If you want to enforce a constraint that the parameter is positive, then you need to do that with a runtime check.

提交回复
热议问题