C# '+=' Operator

前端 未结 2 1488
别那么骄傲
别那么骄傲 2021-01-29 17:02

I have some code that contains the operator \'+=\'.

Specifically, the code reads as follows:

foreach (KeyValuePair row in connecti         


        
相关标签:
2条回答
  • 2021-01-29 17:34

    It adds two strings(or ints etc) together.

    String a = "Hello";
    a += " World";
    

    String a now = "Hello World"

    int i = 0;
    i += 2;
    

    int I now = 2

    0 讨论(0)
  • 2021-01-29 17:39

    It is an assignment operator. It adds right operand to the left operand and assigns the result to left operand.

    You may want read few tutorials, so you can gain better understanding of c# fundamentals.

    0 讨论(0)
提交回复
热议问题