本文介绍了VB到C#转换的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将fallowing vb.net代码转换为c#。我使用telerik转换器进行转换,但是转换后的代码行无效...
I want to convert fallowing vb.net code to c#.I used telerik converter to convert it but the fallowing converted code lines are not working...
private long m_lngMinValue = 0 - 9.22337203685478E+18;
Private m_lngMinValue As Long = 0 - 9.2233720368547758E+18#
Private m_curMaxValue As Decimal = 922337203685477.62
Private m_curMinValue As Decimal = 0 - 922337203685477.62
Private m_intMinValue As Integer = 0 - 2147483648//
&转换后的代码如下,但它给出了错误..
& Converted code is as follows but it is giving error..
private long m_lngMinValue = 0 - 9.22337203685478E+18;// cannot convert double to long
private decimal m_curMaxValue = 922337203685478.0;// solved by replacing 922337203685478.0 by 922337203685478.0M
private decimal m_curMinValue = 0 - 922337203685478.0;//can not convert double to decimal
private int m_intMinValue = 0 - 2147483648L;// can not convert uint to int
推荐答案
private long m_lngMinValue = 0 - 9.22337203685478E+18;
private long m_lngMinValue = 0 - 9.22337203685478E+18;
private decimal m_curMaxValue = 922337203685478.0;
private decimal m_curMinValue = 0 - 922337203685478.0;
private int m_intMinValue = 0 - 2147483648L;
Dim vIn As Double = 0.0
Dim vOut As Decimal = Convert.ToDecimal(vIn)
Dim vIn As Double = 0.0
Dim vOut As Long = Convert.ToInt64(vIn)
Dim vIn As UInteger = 0
Dim vOut As Integer = Convert.ToInt32(vIn)
尝试3以上转换
试试这个链接 []
private long m_lngMinValue =(long)(0 - 9.22337203685478);
private decimal m_curMaxValue = 922337203685478.0m;
private decimal m_curMinValue = 0 - 922337203685478.0m;
private int m_intMinValue = (int)(0 - 2147483647);
这篇关于VB到C#转换的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!