What is the “base class” for C# numeric value types?

后端 未结 6 1637
太阳男子
太阳男子 2020-12-01 11:44

Say I want to have a method that takes any kind of number, is there a base class (or some other concept) that I can use?

As far as I know I have to make overloads f

6条回答
  •  死守一世寂寞
    2020-12-01 12:33

    Are overloaded method signitures out of the question here? If you want a constrained group of methods to performe the same task you could voerload the public method and call a private method that takes any number via casting the input to a double.

提交回复
热议问题