Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

\ operator in VB [duplicate]

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.

like image 597
DotnetSparrow Avatar asked May 16 '11 14:05

DotnetSparrow


People also ask

What is the use of += operator?

The += operator adds the value on its right to the variable or property on its left, and assigns the result to the variable or property on its left.

Is there a += in VBA?

No, it doesn't exist in VBA.

What are the operators in VB?

Visual Basic provides the following types of operators: Arithmetic Operators perform familiar calculations on numeric values, including shifting their bit patterns. Comparison Operators compare two expressions and return a Boolean value representing the result of the comparison.

What does &= mean in VB?

Concatenates a String expression to a String variable or property and assigns the result to the variable or property.


1 Answers

\ 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
like image 122
BoltClock Avatar answered Sep 27 '22 19:09

BoltClock