- Mar 26, 2024
- 11
- 0
- 2
The latest code HelpDialog.cs compilation resulted Compiler Error CS0131. HelpDialog.cs code as below:
public void OnSelectedChanged(HelpContainer oValue, HelpContainer nValue)
{
oValue?.Visible = false;
SelectedChanged?.Invoke(this, EventArgs.Empty);
nValue?.Update();
nValue?.Visible = true;
}
Compiler Error CS0131:The left-hand side of an assignment must be a variable, property or indexer
I checked the grammar and there are no errors, but I don't know why this error keeps occurring.
However, the equivalent code shown below compiles successfully. Could someone please explain this discrepancy?
public void OnSelectedChanged(HelpContainer oValue, HelpContainer nValue)
{
//oValue?.Visible = false;
if (oValue != null)
{
oValue.Visible = false;
}
SelectedChanged?.Invoke(this, EventArgs.Empty);
nValue?.Update();
//nValue?.Visible = true;
if (nValue != null)
{
nValue.Visible = true;
}
}
public void OnSelectedChanged(HelpContainer oValue, HelpContainer nValue)
{
oValue?.Visible = false;
SelectedChanged?.Invoke(this, EventArgs.Empty);
nValue?.Update();
nValue?.Visible = true;
}
Compiler Error CS0131:The left-hand side of an assignment must be a variable, property or indexer
I checked the grammar and there are no errors, but I don't know why this error keeps occurring.
However, the equivalent code shown below compiles successfully. Could someone please explain this discrepancy?
public void OnSelectedChanged(HelpContainer oValue, HelpContainer nValue)
{
//oValue?.Visible = false;
if (oValue != null)
{
oValue.Visible = false;
}
SelectedChanged?.Invoke(this, EventArgs.Empty);
nValue?.Update();
//nValue?.Visible = true;
if (nValue != null)
{
nValue.Visible = true;
}
}
