Lvalues and Rvalues in C#

来源:互联网 发布:java如何制作图形界面 编辑:程序博客网 时间:2024/05/29 10:58

一般左值既可以在表达式的左边也可以在右边;

但是右值只能在表达式的右边;

例如:

a = 10;   正确

a=b+10;正确

10 =11; 错误

英文解释如下:

There are two kinds of expressions in C#:

  1. lvalue: An expression that is an lvalue may appear as either the left-hand or right-hand side of an assignment.

  2. rvalue: An expression that is an rvalue may appear on the right- but not left-hand side of an assignment.

0 0
原创粉丝点击