Operador * (Visual Basic)

Multiplies two numbers.

number1 * number2

Parts

Term

Definition

number1

Required. Any numeric expression.

number2

Required. Any numeric expression.

Result

The result is the product of number1 and number2.

Supported Types

All numeric types, including the unsigned and floating-point types and Decimal.

Comentários

The data type of the result depends on the types of the operands. The following table shows how the data type of the result is determined.

Operand data types

Result data type

Both expressions are integral data types (SByte, Byte, Short, UShort, Integer, UInteger, Long, ULong)

Um numérico tipo de dados apropriado para os tipos de dados de number1 e number2. See the "Integer Arithmetic" tables in Tipos de dados de resultados de operador (Visual Basic).

Both expressions are Decimal

Decimal

Both expressions are Single

Single

Qualquer expressão for uma flutuante-ponto tipo de dados (Single ou Double) mas não ambos Single (nota Decimal não é um flutuante-ponto tipo de dados)

Double

If an expression evaluates to Nothing, it is treated as zero.

Overloading

The * 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. If your code uses this operator on such a class or structure, be sure you understand its redefined behavior. For more information, see Procedimentos de operador (Visual Basic).

Exemplo

This example uses the * operator to multiply two numbers. The result is the product of the two operands.

Dim testValue As Double
testValue = 2 * 2
' The preceding statement sets testValue to 4.
testValue = 459.35 * 334.9
' The preceding statement sets testValue to 153836.315.

Consulte também

Referência

Operador *= (Visual Basic)

Operadores Aritméticos (Visual Basic)

Precedência de operadores no Visual Basic

Operadores listados por Funcionalidade (Visual Basic)

Conceitos

Operadores aritméticos em Visual Basic