跳到主要内容

C# Keywords / C# 关键字

源文档地址

以及它们在 VL 里怎么表达。

图例

  • not-supported —— 这个关键字在 VL 里没有对应物。如果你确实需要它的功能,仍然可以写 C# 代码给 VL 用,见使用 C# 编写节点。
  • no-inheritance —— VL 不支持类继承,因此也没有随之而来的这类概念。

abstract​

C# 参考

abstract class Foo
{
abstract public int Bar();
}

{no-inheritance}

as​

C# 参考

object foo = 1;
var foo = foo as int;

用 CastAs 节点。

base​

C# 参考 · {no-inheritance}

break​

C# 参考

for (int i = 0; i < 10; i++)
{
if (i % 2 == 0)
break;
Console.Beep();
}

见循环的特殊针脚,那里讲了怎么用 Break 输出跳出循环。

case​

C# 参考 · 见 switch。

catch​

C# 参考 · 见 try。

checked​

C# 参考 · {not-supported}

class​

C# 参考 · 见类型草图。

const​

C# 参考 · {not-supported}

continue​

C# 参考 · {not-supported}

decimal​

C# 参考

default​

C# 参考 · 见 switch。

delegate​

C# 参考 · 见 Delegate。

do​

C# 参考 · 见 while。

double​

C# 参考 · 在 VL 里叫 Float64,属于 Primitives 目录。

备注

只有在节点浏览器里启用了 Advanced 视角时才会显示。

else​

C# 参考 · 见 if。

enum​

C# 参考

enum Alignment {Left, Middle, Right};

已有的枚举在 VL 里当然能用,但有一件事 VL 还做不到:定义自定义枚举。需要自定义枚举的话,目前得用 C# 代码来定义,做法见使用 C# 编写节点。

event​

C# 参考 · VL 不用事件,而是用一个类似的概念:Observable。详见响应式。

explicit​

C# 参考 · {not-supported}

extern​

C# 参考 · {not-supported}

finally​

C# 参考 · 见 try。

fixed​

C# 参考 · {not-supported}

float​

C# 参考 · 在 VL 里叫 Float32,属于 Primitives 目录。

for​

C# 参考 · 见循环。

foreach​

C# 参考 · 见循环。

goto​

C# 参考 · {not-supported}

if​

C# 参考 · 见条件。

implicit​

C# 参考 · {not-supported}

in​

C# 参考 · {not-supported}

int​

C# 参考 · 在 VL 里叫 Integer32,属于 Primitives 目录。

interface​

C# 参考 · 见类型草图里的 Interface。

internal​

C# 参考

is​

C# 参考 · {not-supported}

lock​

C# 参考 · {not-supported}

long​

C# 参考 · 在 VL 里叫 Integer64,属于 Primitives 目录。

备注

只有在节点浏览器里启用了 Advanced 视角时才会显示。

namespace​

C# 参考 · namespace 这个概念在 VL 里叫目录。

new​

C# 参考

var date = new DateTime(2002, 12, 24);

new 关键字表示构造器,也就是创建对象新实例的那个运算。在 VL 里,Class 和 Record 的构造器一律叫 Create。

在 VL 里创建一个 DateTime 实例是这样:

(上游此处引用的图片在其仓库中已缺失)

null​

C# 参考 · 属于 Primitive.Object 目录。

备注

只有在节点浏览器里启用了 Advanced 视角时才会显示。

operator​

C# 参考

out​

C# 参考

override​

C# 参考 · {no-inheritance}

params​

C# 参考

private​

C# 参考

protected​

C# 参考 · {no-inheritance}

public​

C# 参考

readonly​

C# 参考 · {not-supported}

ref​

C# 参考

return​

C# 参考

sbyte​

C# 参考 · 在 VL 里叫 Integer8,属于 Primitives 目录。

备注

只有在节点浏览器里启用了 Advanced 视角时才会显示。

sealed​

C# 参考 · {not-supported}

short​

C# 参考 · 在 VL 里叫 Integer16,属于 Primitives 目录。

备注

只有在节点浏览器里启用了 Advanced 视角时才会显示。

sizeof​

C# 参考

stackalloc​

C# 参考 · {not-supported}

static​

C# 参考 · {not-supported}

struct​

C# 参考

switch​

C# 参考 · VL 目前还没有 switch 语句。绕行办法见条件。

this​

C# 参考

throw​

C# 参考

try​

C# 参考 · 见异常处理。

typeof​

C# 参考

uint​

C# 参考 · 在 VL 里叫 Integer32 (Unsigned),属于 Primitives 目录。

备注

只有在节点浏览器里启用了 Advanced 视角时才会显示。

ulong​

C# 参考 · 在 VL 里叫 Integer64 (Unsigned),属于 Primitives 目录。

备注

只有在节点浏览器里启用了 Advanced 视角时才会显示。

unchecked​

C# 参考 · {not-supported}

unsafe​

C# 参考 · {not-supported}

ushort​

C# 参考 · 在 VL 里叫 Integer16 (Unsigned),属于 Primitives 目录。

备注

只有在节点浏览器里启用了 Advanced 视角时才会显示。

using​

C# 参考

virtual​

C# 参考 · {no-inheritance}

void​

C# 参考

volatile​

C# 参考 · {not-supported}

while​

C# 参考 · VL 目前还没有 while 循环。一个简单的绕行办法见循环。