如何为Visual Basic运营\转换成C# [英] How to convert visual basic operator \ in C#

查看:281
本文介绍了如何为Visual Basic运营\转换成C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何转换的Visual Basic运营\在C#中?
我的意思是\的在C#中模拟?



 昏暗 -  [R作为整数
R = X - (5 +(X + 1)\ 6)

感谢




整数除法进行使用\算子。整数除法
返回商,也就是表示的次数
中的除数可分为无
考虑的任何剩余部分的股息的整数。无论是除数和被除数必须
是该运营商整型(为SByte,字节,短,USHORT,整型,UInteger,
long和ulong)。所有其他类型必须首先转换
为整型。下面的示例演示整数
部门。



VB昏暗的K作为整数k = 23 \ 5'前面的语句将K至4。



解决方案

只需使用常规的除法运算符 / 与一个整数变量。


How to convert visual basic operator \ in C# ? I mean which is the analog of \ in C#?

Dim r As Integer
r = x - (5 + (x + 1) \ 6)

Thanks!

Integer division is carried out using the \ Operator. Integer division returns the quotient, that is, the integer that represents the number of times the divisor can divide into the dividend without consideration of any remainder. Both the divisor and the dividend must be integral types (SByte, Byte, Short, UShort, Integer, UInteger, Long, and ULong) for this operator. All other types must be converted to an integral type first. The following example demonstrates integer division.

VB Dim k As Integer k = 23 \ 5 ' The preceding statement sets k to 4.

解决方案

Just use the regular division operator / with an integer variable.

这篇关于如何为Visual Basic运营\转换成C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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