gpt4 book ai didi

C# 在声明变量时转义字符串标识符

转载 作者:太空宇宙 更新时间:2023-11-03 10:45:19 24 4
gpt4 key购买 nike

有没有办法声明一个涉及符号的变量?如:

int MIN% = 0;

string DE/M = "";

最佳答案

参见 Variable Naming Rules - C#

  • The first character of a variable name must be either a letter, an underscore character (_), or the at symbol (@).

  • Subsequent characters may be letters, underscore characters, or numbers.

变量名中不能有除 _ 以外的任何特殊字符,(或 @ 符号作为第一个字符) - 因此没有必要转义它。

关于C# 在声明变量时转义字符串标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23685589/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com