C# is an object-oriented language from Microsoft with a syntax similar to that of Java (see JavaLanguage
). See CsharpFeatures
for a few details. See the online language reference  or download a word document  version of the reference or view a quick introduction to the language .
Please keep all discussion
of the language and its features in CsharpLanguageDiscussion
Preliminary drafts of the next edition of the CsharpLanguage
standard (featuring generics [ParametricPolymorphism
], anonymous delegates [LambdaExpression
s with LexicalClosure
], partial types [just a way of splitting the definition of a type over multiple files - not very interesting really, except for people involved in code generation], nullable types, and various other new features), as of July 2004, are available at:
Interesting C#-related Discussions:
For comparisons with other languages, see...
- And, of course, LanguagePissingMatch.
- Similarly, a strongly critical fake FAQ, essentially a CSharp bashing page (concentrating on bashing technical issues) from a Java fanatic: http://www.geocities.com/csharpfaq/ (slow site). At first glance it looks like a regular FAQ, until one notices a pattern in the conclusion of each article. Most of the criticisms are reasonable, but the recommendation given in the answer to the second test is wrong: operator overloading is a GoodThing, as long as + means + and indexing means indexing (and << and >> mean << and >>). If it wasn't for that last bit the fact that each recommendation makes it more Java-y could be a coinkydink.
Csharp ECMA Plans
I just thought I'd write a quick clarification to some of these emails. Last week Fujitsu, HP, Intel and Microsoft presented a proposal to ECMA's TC39 for the standardization of C# and the Common Language Infrastructure (CLI). The CLI consists on a runtime, a set of framework classes, a unified type system and a set of bindings to allow compiler developers to produce compilers for the CLI.
TC39 adopted a resolution commissioning 2 task groups to work on producing the standards for C# and the CLI. The C# task group is being convened by Carol Thompson of HP and the CLI group by Sam Ruby from IBM. Member companies from TC39 that were interested in working on this technology included IBM, Netscape, Sun, SHARE and Pixo.
During the presentation I was asked about whether or not there were 2 or more implementations of the CLI. At Microsoft we have implemented 2 versions of the CLI. These are known as our .NET Frameworks and .NET Compact Frameworks. Further it was asked what platforms these were running on. Currently Microsoft has these frameworks running on all the Windows platforms (Win2K through WinCE) and 1 non-Windows platform. Unfortunately I'm not able to comment any further on the non-Windows platform.
Additionally I was asked about open-source implementations, specifically a reference implementation. The sponsors of this project are considering an open-source implementation but have not made any decisions yet. In terms of releasing a reference implementation, it is the intention of the sponsors to work towards a full specification and not reference the solution to ambiguities to a particular implementation. This is fundamentally different from what has been suggested previously by some other companies.
We are very excited by the approval of ECMA for standardizing this technology and look forward to progressing through to a final standard around the end of next year.
If you have any questions please feel free to email me directly.
C# Product Manager
simply a way for Microsoft to offer a Java that's tightly bound to the Windows API? They tried to extend Java, and the trademark/copyright holder (Sun) squawked. So they changed around some stuff, gave it a new name, and -- voila -- CeeSharp
. Look, Billy learned from Windows 3.1 (in comparison to the Mac look and feel) that all he has to do is change the name, make some changes here and there, and throw a gaggle of lawyers at the problem. I actually think that the concept of a Java that is tightly bound to the underlying platform is really great, and I wish Sun would just let us avoid the CeeSharp
That depends, isn't JavaLanguage a way for Sun to offer a CeePlusPlus that's tightly bound to their own VM and dumbed down to make programming easier? Listen, every time a new C language comes out someone is going to claim theft. The fact is Java is broken in the view of many, it went too far and removed too many useful C constructs. Java stole ideas from ObjectiveCee, which stole them from SmalltalkLanguage. Every language borrows ideas from every other language, that's how it works. There haven't been any new ideas in like 20 years, existing ideas are just being recycled in different combinations.
I fear I didn't explain myself clearly enough. Immediately prior to announcing the creation of CeeSharp
, Microsoft and Sun had been in a public and protracted trademark dispute, which arose because Microsoft was distributing a Microsoft-specific Java VM (with the Java Logo) that provided direct access to the Windows API. Sun objected, claiming that this approach locked the resulting programs into Microsoft platforms. This replayed the earlier similar conflict between Digitalk and ParcPlace
about using native GUI within Smalltalk (with ParcPlace
playing the role of Sun and Digitalk playing the role of Microsoft). The courts sided with Sun, and Microsoft responded by announcing CeeSharp
. I make no value judgement here, in fact I thought I said pretty clearly that I prefer a Java that uses the real native UI. We learned how to do it in Smalltalk, and I think Java benefits from this change. Thus, I'm fine with "CeeSharp
", I just think it would be cleaner and more accurate to either call it Java or Java++.
C# is much more palatable to C++ developers because it allows them to keep Enums and stack based structs while offering the niceities of garbage collection and a more solid OO feel. Everything, even the primitives are objects. If you look at Java code, you'll find developers hack up these missing features anyway, so why not include them in the language? Not to meantion, C# is a standardized language, Java still isn't, Microsoft seems to be behaving far better than Sun in this situation, I'd keep that in mind when trying to make accusations.
Who's making accusations? Meanwhile, are any CeeSharp
implementations available for the Macintosh, Unix, or Linux? From what vendors? And are there any open-source CeeSharp
Yes, there are! Mono is the most complete I believe, for Linux.
Also, Microsoft offers .NET for OSX and FreeBSD.
"C# is a standardized language, Java still isn't" - only if you accept the premise that Microsoft can write standards while Sun cannot. Quite an assumption there.
has actually implemented and released a shared source implementation of the CLI, codenamed Rotor (see SharedSourceCli
). Also, there is ongoing work on an open source, Linux-based implementation of the CLI and a CsharpCompiler?
over at http://go-mono.com
Furthermore, there is ongoing work on a free software GNU/Linux and Win32 implementation (which actually started 6 months before the mono project if I am not mistaken). For more details, see http://www.dotgnu.org
Is there a TestingFramework
, and CsUnit
. United Binary has HarnessIt
which looks interesting.''
A lot of discussion moved to CsharpLiteratureAndInterviews
Forecoming features of this language can be seen as this address:
Open Source Community: http://csharp-source.net
Deep Inside C# - An interview with Microsoft Chief Architect Anders Hejlsberg, the chief inventor of the C# Language.
Top Ten Traps in C# for C++ Programmers: An article written by Jesse Liberty, the author of Programming C#. This interesting article points out the main difference between C# and C++ and what should be noted when programmers were switching from C++ to C#.
The .NET framework is horribly incomplete with things like Com interop and late binding (VB.NET is much better for this), and misses a whole slew of conversions. Conversions/casts are very weak too, you can't convert a string to a StringCollection?
or a List<string>. Features in one collection/list/array aren't present in the other. You cant even cast a string to an int without a library call. Strings are immutable, making you include instantiate a new class (stringbuilder). And the lack of string processing (which nearly every program needs heavily) makes it very verbose. A simple one-liner in VB or scheme takes 8 lines and a loop. It also holds the record for the ugliest and least useful switch command. You must use useless break
s and you can only switch on int/strings.
Not true. I switch on enums every day. However, I have become a bit anti-if, and look for strategy patterns to eliminate switch and if statements.
See also: CsharpFeatures
CategoryCeeSharp CategoryProgrammingLanguage CategoryMicrosoftTechnology CategoryDotNet