Assignment Operator

Definition & Meaning

Last updated 23 month ago

What is Assignment Operator?

An undertaking Operator is the operator used to assign a brand new value to a Variable, assets, occasion or Indexer element in C# Programming Language. Assignment Operators can also be used for logical operations consisting of bitwise logical operations or operations on imperative Operands and Boolean operands.

Unlike in C , task operators in C# can't be overloaded directly, but the consumer-defined types can overload the operators like , -, /, and so forth. This lets in the undertaking operator to be used with the ones sorts.

What Does Assignment Operator Mean?

The following are the traits of task operators:

  • When the use of the "=" operator for an undertaking with the left operand as the property or Indexer get entry to, the assets or indexer ought to have a fixed Accessor.
  • Overloading a Binary Operator implicitly overloads its corresponding assignment operator (if any).
  • The exclusive task operators are based totally at the type of operation achieved between operands along with addition ( =), subtraction, (-=), and so on. The that means of the operator symbol used depends at the kind of the operands.
  • Assignment operators are proper-associative, which means they are grouped from right to left.
  • Although undertaking the use of assignment operator (a = b) achieves the same end result as that with out ( =a b), the difference among the two approaches is that in contrast to inside the latter example, "a" is evaLuated simplest as soon as.
  • The project operator normally returns a reference to the item with a purpose to be used in more than one assignments made in a single assertion together with "a=b=c", where a, b and c are operands.
  • The undertaking operator expects the kind of both the left- and right-hand side to be the same for a success challenge.

In C#, an Expression using an assignment operator is probably "x op y", wherein x and y are operands and "op" represents the operator. The simple venture operator "=" is used to shop the fee of its right-hand operand into the Memory viciNity denoted with the aid of the left-hand operand. The end result is its return cost. The different project operators that perForm indicated operation on the two operands and assign a resulting price to the left operand are known as compound assignment operators. These consist of=

  • ^=
  • <<= and >>=
  • Share Assignment Operator article on social networks

    Your Score to Assignment Operator article

    Score: 5 out of 5 (1 voters)

    Be the first to comment on the Assignment Operator

    159- V4

    tech-term.com© 2023 All rights reserved