I want to know what is purpose of '\' in vb ? I have this statement:
frontDigitsToKeep \ 2
and I want to convert it to C#.
Please suggest.
\ is the integer division operator in VB.NET.
For C#, just use the standard / operator instead and assign the result to some integer type:
frontDigitsToKeep / 2
You need an integer typecast if frontDigitsToKeep itself isn't an integer:
(int) frontDigitsToKeep / 2
100 \ 9 = 11 in VB.NET is equivalent to 100 - (100 % 9) / 9 in C#.
frontDigitsToKeep - (frontDigitsToKeep % 2) / 2
The equivalent code in c# is
frontDigitsToKeep / 2
for such conversion from C# to VB.Net and vb.net to c# follow the link
http://converter.telerik.com/
Say you're trying to compute how many coins are packaged without caring for the leftovers. You would use \ to do integer division.
So ( 4 * 5 ) \ 6 would equal 3.
As for how to put it into C#, you would use frontDigitsToKeep - (frontDigitsToKeep % 2) / 2.
加载中,请稍侯......
精彩评论