If I'm using something like this:
xr.Settings.ValidationFlags |= XmlSchemaValidationFlags.ReportValidationWarnings;
What precisely is the |= accomplishing?
|= is a shortcut for OR'ing two values together and assigning the result to the first variable.
xr.Settings.ValidationFlags |= XmlSchemaValidationFlags.ReportValidationWarnings;
Is equivalent to:
xr.Settings.ValidationFlags = xr.Settings.ValidationFlags | XmlSchemaValidationFlags.ReportValidationWarnings;
| is the OR operator in C#, so the code above effectively sets the ReportValidationWarnings flag on the value xr.Settings.ValidationFlags.
In this case you are setting XmlSchemaValidationFlags.ReportValidationWarnings flag in your ValidationFlags.
|= is generally bitwise or operator, in case of Flags it's used to set flag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With