VB到C#转换的问题 [英] Problem in VB to C# conversion

查看:123
本文介绍了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以上转换

试试这个链接 http:/ /www.convertdatatypes.com/Convert-UInteger-to-Integer-in-VB.net.html [ ^ ]


您应该只复制并粘贴VB代码中的原始值转换为C#转换后的代码。



之后在C#代码中你应该把(长)从第一个值(十进制)放在第三个值前面(用于转换)价值观)和你所承担的第四种变量类型d将其类型从int替换为uint!
You should just copy and paste the original values from the VB code into the C# converted code.

After that in C# code you should put (long) in from of 1st value, (decimal) in front of 3rd value (for conversion the values), and the 4th variable type you should replace its type from "int" to "uint"!


我已经解决了这个问题...

I have solved this...
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#转换的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆