What's the difference if you use a "+" or no "+" in outputting?
c#, string, text
Solution
`+=` will append `(someString)` to the existing value of `Div1.InnerHtml`, whereas `=` will replace the value of `Div1.InnerHtml` with `(someString)`.
If the results are the same then the starting value of `Div1.InnerHtml` is likely `null` or `string.Empty` (`""`)
Regarding `InnerText` vs `InnerHtml`: `InnerHtml` might return something like `<h1>Hello World</h1>` whereas `InnerText` would return `Hello World` (the value of the element without the actual HTML element).
Consider these cases:
string someString = "Hello";
string innerHtml = "";
innerHtml += someString; // result will be "Hello"
string someString = "Hello";
string innerHtml = "";
innerHtml = someString; // result will be "Hello"
string someString = "Hello";
string innerHtml = "World";
innerHtml += someString; // result will be "HelloWorld"
string someString = "Hello";
string innerHtml = "World";
innerHtml = someString; // result will be "Hello"
Problem
``` Div1.InnerHtml = (someString); ``` -VS- ``` Div1.InnerHtml += (someString); ``` I notice they both do the same thing, but is there any real difference whether I have the `+` in there or not? Also.. What's the difference between `InnerText` & `InnerHtml`?