InternetUnicodeHTMLCSSScalable Vector Graphics (SVG)Extensible Markup Language (xml) ASP.Net TOCASP.NetMiscellaneous Feature ASP.NET Scripting Visual Basic .NET TOCVB .NET Language ReferencenaVB.Net Elements OperatorArithmetic OperatorCompare OperatorConcatenation OperatorLogical/Bitwise OperatorBit Shift Operator Draft for Information Only
Content
VB.NET Assignment Operators
VB.NET Assignment OperatorsThe supporting VB.NET Assignment Operators are =, ^=, *=, /=, \=, +=, -=, <<=, >>=, &=. = OperatorAssigns a value to a variable or property. Syntaxvariableorproperty = value Partsvariableorproperty: Any writable variable or any property. value: Any literal, constant, or expression. RemarksThe element on the left side of the equal sign (=) can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly. The = operator assigns the value on its right to the variable or property on its left. Note The = operator is also used as a comparison operator. For details, see Comparison Operators. OverloadingThe = operator can be overloaded only as a relational comparison operator, not as an assignment operator. For more information, see Operator Procedures. See also
^= OperatorRaises the value of a variable or property to the power of an expression and assigns the result back to the variable or property. Syntaxvariableorproperty ^= expression Partsvariableorproperty: Required. Any numeric variable or property. expression: Required. Any numeric expression. RemarksThe element on the left side of the ^= operator can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly. The ^= operator first raises the value of the variable or property (on the left-hand side of the operator) to the power of the value of the expression (on the right-hand side of the operator). The operator then assigns the result of that operation back to the variable or property. Visual Basic always performs exponentiation in the Double Data Type. Operands of any different type are converted to Double, and the result is always Double. The value of expression can be fractional, negative, or both. OverloadingThe ^ Operator can be overloaded, which means that a class or structure can redefine its behavior when an operand has the type of that class or structure. Overloading the ^ operator affects the behavior of the ^= operator. If your code uses ^= on a class or structure that overloads ^, be sure you understand its redefined behavior. For more information, see Operator Procedures. See also
*= OperatorMultiplies the value of a variable or property by the value of an expression and assigns the result to the variable or property. Syntaxvariableorproperty *= expression Partsvariableorproperty: Required. Any numeric variable or property. expression: Required. Any numeric expression. RemarksThe element on the left side of the *= operator can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly. The *= operator first multiplies the value of the expression (on the right-hand side of the operator) by the value of the variable or property (on the left-hand side of the operator). The operator then assigns the result of that operation to the variable or property. OverloadingThe * Operator can be overloaded, which means that a class or structure can redefine its behavior when an operand has the type of that class or structure. Overloading the * operator affects the behavior of the *= operator. If your code uses *= on a class or structure that overloads *, be sure you understand its redefined behavior. For more information, see Operator Procedures. See also
/= OperatorDivides the value of a variable or property by the value of an expression and assigns the floating-point result to the variable or property. Syntaxvariableorproperty /= expression Partsvariableorproperty: Required. Any numeric variable or property. expression: Required. Any numeric expression. RemarksThe element on the left side of the /= operator can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly. The /= operator first divides the value of the variable or property (on the left-hand side of the operator) by the value of the expression (on the right-hand side of the operator). The operator then assigns the floating-point result of that operation to the variable or property. This statement assigns a Double value to the variable or property on the left. If Option Strict is On, variableorproperty must be a Double. If Option Strict is Off, Visual Basic performs an implicit conversion and assigns the resulting value to variableorproperty, with a possible error at run time. For more information, see Widening and Narrowing Conversions and Option Strict Statement. OverloadingThe / Operator (Visual Basic) can be overloaded, which means that a class or structure can redefine its behavior when an operand has the type of that class or structure. Overloading the / operator affects the behavior of the /= operator. If your code uses /= on a class or structure that overloads /, be sure you understand its redefined behavior. For more information, see Operator Procedures. See also
\= OperatorDivides the value of a variable or property by the value of an expression and assigns the integer result to the variable or property. Syntaxvariableorproperty \= expression Partsvariableorproperty: Required. Any numeric variable or property. expression: Required. Any numeric expression. RemarksThe element on the left side of the \= operator can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly. The \= operator divides the value of a variable or property on its left by the value on its right, and assigns the integer result to the variable or property on its left For further information on integer division, see \ Operator (Visual Basic). OverloadingThe \ operator can be overloaded, which means that a class or structure can redefine its behavior when an operand has the type of that class or structure. Overloading the \ operator affects the behavior of the \= operator. If your code uses \= on a class or structure that overloads \, be sure you understand its redefined behavior. For more information, see Operator Procedures. See also
+= OperatorAdds the value of a numeric expression to the value of a numeric variable or property and assigns the result to the variable or property. Can also be used to concatenate a String expression to a String variable or property and assign the result to the variable or property. Syntaxvariableorproperty += expression Partsvariableorproperty: Required. Any numeric or String variable or property. expression: Required. Any numeric or String expression. RemarksThe element on the left side of the += operator can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly. 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. The += operator can also be used to concatenate the String expression on its right to the String variable or property on its left, and assign the result to the variable or property on its left. Note When you use the += operator, you might not be able to determine whether addition or string concatenation will occur. Use the &= operator for concatenation to eliminate ambiguity and to provide self-documenting code. This assignment operator implicitly performs widening but not narrowing conversions if the compilation environment enforces strict semantics. For more information on these conversions, see Widening and Narrowing Conversions. For more information on strict and permissive semantics, see Option Strict Statement. If permissive semantics are allowed, the += operator implicitly performs a variety of string and numeric conversions identical to those performed by the + operator. For details on these conversions, see + Operator. OverloadingThe + operator can be overloaded, which means that a class or structure can redefine its behavior when an operand has the type of that class or structure. Overloading the + operator affects the behavior of the += operator. If your code uses += on a class or structure that overloads +, be sure you understand its redefined behavior. For more information, see Operator Procedures. See also
-= OperatorSubtracts the value of an expression from the value of a variable or property and assigns the result to the variable or property. Syntaxvariableorproperty -= expression Partsvariableorproperty: Required. Any numeric variable or property. expression: Required. Any numeric expression. RemarksThe element on the left side of the -= operator can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly. The -= operator first subtracts the value of the expression (on the right-hand side of the operator) from the value of the variable or property (on the left-hand side of the operator). The operator then assigns the result of that operation to the variable or property. OverloadingThe - Operator (Visual Basic) can be overloaded, which means that a class or structure can redefine its behavior when an operand has the type of that class or structure. Overloading the - operator affects the behavior of the -= operator. If your code uses -= on a class or structure that overloads -, be sure you understand its redefined behavior. For more information, see Operator Procedures. See also
<<= OperatorPerforms an arithmetic left shift on the value of a variable or property and assigns the result back to the variable or property. Syntaxvariableorproperty <<= amount Partsvariableorproperty: Required. Variable or property of an integral type (SByte, Byte, Short, UShort, Integer, UInteger, Long, or ULong). amount: Required. Numeric expression of a data type that widens to Integer. RemarksThe element on the left side of the <<= operator can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly. The <<= operator first performs an arithmetic left shift on the value of the variable or property. The operator then assigns the result of that operation back to that variable or property. Arithmetic shifts are not circular, which means the bits shifted off one end of the result are not reintroduced at the other end. In an arithmetic left shift, the bits shifted beyond the range of the result data type are discarded, and the bit positions vacated on the right are set to zero. OverloadingThe << Operator can be overloaded, which means that a class or structure can redefine its behavior when an operand has the type of that class or structure. Overloading the << operator affects the behavior of the <<= operator. If your code uses <<= on a class or structure that overloads <<, be sure you understand its redefined behavior. For more information, see Operator Procedures. See also
>>= OperatorPerforms an arithmetic right shift on the value of a variable or property and assigns the result back to the variable or property. Syntaxvariableorproperty >>= amount Partsvariableorproperty: Required. Variable or property of an integral type (SByte, Byte, Short, UShort, Integer, UInteger, Long, or ULong). amount: Required. Numeric expression of a data type that widens to Integer. RemarksThe element on the left side of the >>= operator can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly. The >>= operator first performs an arithmetic right shift on the value of the variable or property. The operator then assigns the result of that operation back to the variable or property. Arithmetic shifts are not circular, which means the bits shifted off one end of the result are not reintroduced at the other end. In an arithmetic right shift, the bits shifted beyond the rightmost bit position are discarded, and the leftmost bit is propagated into the bit positions vacated at the left. This means that if variableorproperty has a negative value, the vacated positions are set to one. If variableorproperty is positive, or if its data type is an unsigned type, the vacated positions are set to zero. OverloadingThe >> Operator can be overloaded, which means that a class or structure can redefine its behavior when an operand has the type of that class or structure. Overloading the >> operator affects the behavior of the >>= operator. If your code uses >>= on a class or structure that overloads >>, be sure you understand its redefined behavior. For more information, see Operator Procedures. See also
&= OperatorConcatenates a String expression to a String variable or property and assigns the result to the variable or property. Syntaxvariableorproperty &= expression Partsvariableorproperty: Required. Any String variable or property. expression: Required. Any String expression. RemarksThe element on the left side of the &= operator can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly. The &= operator concatenates the String expression on its right to the String variable or property on its left, and assigns the result to the variable or property on its left. OverloadingThe & Operator can be overloaded, which means that a class or structure can redefine its behavior when an operand has the type of that class or structure. Overloading the & operator affects the behavior of the &= operator. If your code uses &= on a class or structure that overloads &, be sure you understand its redefined behavior. For more information, see Operator Procedures. See also
Source/Reference
©sideway ID: 200800005 Last Updated: 8/5/2020 Revision: 0 Ref: ![]() References
![]() Latest Updated Links
![]() ![]() ![]() ![]() ![]() |
![]() Home 5 Business Management HBR 3 Information Recreation Hobbies 8 Culture Chinese 1097 English 339 Travel 18 Reference 79 Computer Hardware 254 Software Application 213 Digitization 37 Latex 52 Manim 205 KB 1 Numeric 19 Programming Web 289 Unicode 504 HTML 66 CSS 65 SVG 46 ASP.NET 270 OS 431 DeskTop 7 Python 72 Knowledge Mathematics Formulas 8 Set 1 Logic 1 Algebra 84 Number Theory 206 Trigonometry 31 Geometry 34 Calculus 67 Engineering Tables 8 Mechanical Rigid Bodies Statics 92 Dynamics 37 Fluid 5 Control Acoustics 19 Natural Sciences Matter 1 Electric 27 Biology 1 |
Copyright © 2000-2025 Sideway . All rights reserved Disclaimers last modified on 06 September 2019