What is Lvalues and Rvalues in C#:
There are two kinds of expressions in C#:
lvalue: An expression that is an lvalue may appear as either the left-hand or right-hand side of an assignment.
rvalue: An expression that is an rvalue may appear on the right- but not left-hand side of an assignment.
Variables are lvalues and so may appear on the left-hand side of an assignment. Numeric literals are rvalues and so may not be assigned and can not appear on the left-hand side. Following is a valid statement:
int g = 10;
But following is not a valid statement and would generate compile-time error:
10 = 100;
There are two kinds of expressions in C#:
lvalue: An expression that is an lvalue may appear as either the left-hand or right-hand side of an assignment.
rvalue: An expression that is an rvalue may appear on the right- but not left-hand side of an assignment.
Variables are lvalues and so may appear on the left-hand side of an assignment. Numeric literals are rvalues and so may not be assigned and can not appear on the left-hand side. Following is a valid statement:
int g = 10;
But following is not a valid statement and would generate compile-time error:
10 = 100;