有C#等同于Python的chr和ord吗?

Mah*_*any 3 c# python char

我目前正在学习C#,想知道C#是否具有与和等效的功能chrord

Dmi*_*nko 5

C#char是有效的UInt16; 这就是为什么我们可以简单地投射

chr: (char) 显式强制转换(如果i超出[0..UInt16.MaxValue]范围,我们将发生整数溢出)

 int i = ...
 char c = (char) i; 
Run Code Online (Sandbox Code Playgroud)

ORD:要么(int)甚至隐含投(从投charint始终是可能的)

 char c = ...
 int i = c;
Run Code Online (Sandbox Code Playgroud)