为什么没有INT过载SqlFunctions.StringConvertINT、SqlFunctions、StringConvert

2023-09-08 09:48:19 作者:岁月的颓废

标题pretty的多总结起来。我敢打赌,超过这个方法在野外的一半,用途包括铸造的人一个int到一个小数或双为​​了使用它,那么为什么不只是有一个重载接受一个int作为参数?

Title pretty much sums it up. I'd bet that over half the usage of this method in the wild involves someone casting an int to a decimal or double in order to use it, so why isn't there just an overload that takes an int as the argument?

http://msdn.microsoft.com/en-us/library/system.data.objects.sqlclient.sqlfunctions.stringconvert.aspx

推荐答案

由于它直接关系到这里找到STR功能:

Because it's directly related to the STR function found here:

http://msdn.microsoft.com/en-us/library/ ms189527.aspx

和该功能只需要一个浮动,因此,您所看到的参数。

and that function only takes a float, hence the parameters you're seeing.