views:

882

answers:

9

I am a C and C++ programmer and am now trying to learn C#. I have bought the book Professional C# by Wrox publications.

While migrating from C to C++ I had a doubt why ++ was added to C. Later on I realized that since ++ is an increment operator and it was added to C just to provide an 'Object Oriented Extension'.

In C#, what is the significance of #?

A: 

well while c++ is c with "Object Oriented Extension", c# on the other hand is not based on c only the syntax and is totaly object oriented and compiles to msil while native c++ compiles to native binary code...

Petoj
totally object oriented?
Kugel
everything is contained in some soft of class / struct
Petoj
+3  A: 

Have a look at this explanation: http://www.jameskovacs.com/blog/CNETHistoryLesson.aspx

C# name was musically inspired. It is a C-style language that is a step above C/C++, where sharp (#) means a semi-tone above the note.

driis
+31  A: 

The name "C sharp" was inspired from musical notation where a sharp indicates that the written note should be made a half-step higher in pitch.[6] This is similar to the language name of C++, where "++" indicates that a variable should be incremented by 1. The sharp symbol also resembles a ligature of four "+" symbols (in a two-by-two grid), further implying that the language is an increment of C++.

Due to technical limitations of display (standard fonts, browsers, etc.) and the fact that the sharp symbol (♯, U+266F, MUSIC SHARP SIGN) is not present on the standard keyboard, the number sign (#, U+0023, NUMBER SIGN) 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.3 However, when it is practical to do so (for example, in advertising or in box art[8]), Microsoft uses the intended musical symbol.

From Wikipedia.

Also, in this interview, Anders Hejlseberg says:

"We wanted to have a reference to the language’s C heritage in the name and finally settled on C#. Some other candidates I recall were e-C, Safe C, C-square, C-cube, C-prime, C-star, and Cesium… Looking and those now I’m pretty happy with our choice."

Finally, Naomi Hamilton asked Anders Hejlseberg the question directly:

[NH] Why was the language originally named Cool, and what promoted the change to C#?

[AH] The code name was Cool, which stood for ‘C like Object Oriented Language’. We kind of liked that name: all of our files were called .cool and that was kind of cool! We looked seriously at keeping the name for the final product but it was just not feasible from a trademark perspective, as there were way too many cool things out there.

So the naming committee had to get to work and we sort of liked the notion of having an inherent reference to C in there, and a little word play on C++, as you can sort of view the sharp sign as four pluses, so it’s C++++. And the musical aspect was interesting too. So C# it was, and I’ve actually been really happy with that name. It’s served us well.

Gregory Pakosz
What, Jon Skeet didn't name it?
Winston Smith
Named C# because Beethoven's "Moonlight Sonata," favorite of Bill Gates, and Anders Hejlsberg, is written in C# Minor. Anders, a Dane, also may have been aware of the academic debate going on over whether King Frederik VI of Denmark's Court had been one of the ten "Royal courts" who subscribed to Beethoven's Missa Solemnis, Opus 123 : perhaps he was aware that recent academic research confirmed the Danish subscription exists in a Copenhagen archive. When C# was named, Jon Skeet was still only in "dormant human form;" not yet metaphysically transformed into the Hierophant of the DotNetVerse. :)
BillW
@Gregory: RE: The flag you sent on this answer. It looks like you've hit the daily reputation cap of 200 points. See the "What is reputation?" section of the FAQ. http://stackoverflow.com/faq
Bill the Lizard
@Bill the Lizard: does it mean that deleting my answer on another question with 3 votes up in order to reduce noise brings the cap down to 170?
Gregory Pakosz
Incidentally, the directory in the C# sources that contains the checkin test suites is still called "safec". No one ever bothered to change it.
Eric Lippert
I mostly agree with Anders, but C-prime - that's pretty nice.
Michael Petrotta
A: 

the '#' is actually meant to be a musical sharp symbol - as ++ indicates C++ is C incremented, C# is implying the same kind of thing; a language with C-syntax, offering higher-level functionality.

Check out the wikipedia article on this.

kronoz
+1  A: 

It's just a name. The # character is taken from the musical notation meaning C# (C sharp) is half a note above C.

C# is partly based on C/C++, but also on Java and Pascal (Delphi). Like Java, C# is an object oriented language, while C++ and Pascal are procedural languages with added capability for object orientation.

Guffa
+1  A: 

In addition to the musical references noted elsewhere, observe that '♯' and '#' look like two '+' symbols overlapped.

In the end, though it was a marketing decision, not a technical one.

(As an aside: at the time, we thought it was a poor choice because search engines would ignore "special" characters, and you'd get results for 'C'. Now, search engines are smarter.)

EDIT: Here's an image, if you hadn't figured it out already. I'm a programmer, not a graphic artist, which is obvious.

alt text

Jay Bazuzi
it's 4 `+` symbols overlapped actually :)
Gregory Pakosz
+3  A: 

Given that this is a programmer's web site, perhaps it is interesting to list the "real names", the names that the Microsoft programmers used when they worked on the projects. These names tend to show up, like archeological records, in the source code for the CLR (Rotor), SDK header files and the Reference Source.

C# started out as COOL (C-like Object Oriented Language). The Rotor makefiles show that early C# code might have been written in files with the .cool filename extension. However, there are also several places where it is named COOLC.

The CLR had several names. It started out as a project inside the group that worked on Windows 2000's COM+, there are many references to "ComPlus" in the CLR source code. The exception code for a managed exception is 0xe0434f4e, 0xe0 + "COM"+1. In the WinError.h file, CLR error codes use "URT", "Universal Run Time". The contraction "Cor" appears in many places in the hosting interfaces, "COM Object Runtime". CLR source code very commonly uses the EE acronym, distinct from COR. Not sure what it means.

Internal project names I've seen:

  • Rainier: Visual Studio 2002
  • Everett: Visual Studio 2003
  • Whidbey: Visual Studio 2005
  • Orcas: Visual Studio 2008
  • Hawaii: Visual Studio 2010 (very early)
  • Rotor: Shared Source version of the CLR
  • Avalon: WPF
  • Indigo: WCF
  • Yukon: SQL Server 2005
  • Katmai: SQL Server 2008
Hans Passant
EE is "Execution Engine."
Jason
+1 for the inclusion of *Cool*.
Cecil Has a Name
EE is not "execution engine" in the C# compiler, though it might be in the CLR, I wouldn't know. In the C# compiler EE is "expression evaluator" -- the EE stuff in the compiler is the parts of the compiler which implement the "watch" and "local" window behaviour in the debugger; you give it an expression at debug time, and the EE evaluates it against the context of the running program state. I would be (mildly) surprised if it meant something different in the CLR sources.
Eric Lippert
The File Description property for the file version info resource in mscoree.dll is "Microsoft .NET Runtime Execution Engine".
Hans Passant
+3  A: 

In 1991, Al Stevens introduced D-Flat in Dr. Dobbs Journal (DDJ); a DOS-based, event-driven framework for building user interfaces (see http://www.ddj.com/184408553). At the time, D-Flat was written in C, because Al Stevens wrote the C Programming column for DDJ. The name C++ was already taken and he had considered C-Sharp, but was convinced that someone had already thought of it (see http://www.ddj.com/184410858). My opinion is that Al Stevens had been thinking about the name C-Sharp for a long time, because D-Flat was not a whim and he has so much language experience.

+1  A: 

C# is a musically inspired named and there is also Polyphonic C#

jlru