问题描述
可能有点愚蠢的问题,但我有一个我一直在使用的变量(库的一部分)(它让我可以访问很多属性和函数).我希望它尽可能短,并且最好是易于编写的内容.jQuery 的$"会非常棒,但这不起作用,我尝试过的任何数字或符号也不起作用.我可以使用诸如s"之类的东西,但我希望有更好的东西(而且不仅仅是一个无聊的拉丁字母).
Probably a bit silly of a problem, but I have this one variable (a part of a library) that I am using all the time (it gives me access to a whole lot of properties and functions). I want it to be as short as possible, and, preferably, something easy to write. jQuery's "$" would be pretty great, but that doesn't work, neither do any numbers or symbols I tried. I could use something like "s", but I was hoping there'd be something even better (and something that's not just one boring Latin letter).
那么 SO 最好的超短而酷的变量名是什么?
So what would be SO's best super-short-and-awesome variable name?
推荐答案
我还建议不要这样做 - 最好使用一个能解释变量用途的名称.
I'd also advise not to do that - it's much better to use a name that explains the purpose of the variable.
但是本着回答问题的精神:您可以使用下划线:_
.
However in the spirit of answering the question: You could use underscore: _
.
它是 C#(和许多其他语言)中的有效变量名.顺便说一句,这不是一个新想法 - 我已经看到 C 和 Python 中的一些框架使用下划线作为接受字符串的方法,这意味着这个字符串应该被本地化.
It's a valid variable name in C# (and many other langauges). This isn't a new idea by the way - I have seen some frameworks in C and Python that use underscore as a method that takes a string meaning this string should be localized.
这篇关于C#中的超短和真棒变量名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!