其实真正的名字是"C♯"(C Sharp), 而不是"C#"。前一个是乐谱里常用的代表升半音的符号,后一个是表示数字的符号。
之所以经常被写成后一种,仅仅是因为#这个字符输入比较方便。
维基百科:
The name "C sharp" was inspired by musical notation where a sharp indicates that the written note should be made asemitone higher in pitch.[6] This is similar to the language name of C++, where "++" indicates that a variable should be incremented by 1.
Due to technical limitations of display (standard fonts, browsers, etc.) and the fact that the sharp symbol (U+266F ♯music sharp sign (HTML: ♯
)) is not present on the standard keyboard, the number sign (U+0023 # number sign(HTML: #
)) was chosen to represent the sharp symbol in the written name of the programming language.[7] This convention is reflected in the ECMA-334 C# Language Specification.[5] However, when it is practical to do so (for example, in advertising or in box art[8]), Microsoft uses the intended musical symbol.
The "sharp" suffix has been used by a number of other .NET languages that are variants of existing languages, including J# (a .NET language also designed by Microsoft that is derived from Java 1.1), A# (from Ada), and the functional programming language F#.[9] The original implementation of Eiffel for .NET was called Eiffel#,[10] a name retired since the full Eiffel language is now supported. The suffix has also been used for libraries, such as Gtk# (a .NET wrapper for GTK+ and other GNOME libraries), Cocoa# (a wrapper for Cocoa).