Was C# compiler written in C++?
Yes, but there are plans to write a C# compiler in C#, which I believe was discussed in this podcast.
Yes.
The Mono C# compiler is written in C#.
The .NET framework was written in Simple Managed C (SMC)
History
During the development of the .NET Framework, the class libraries were originally written using a managed code compiler system called Simple Managed C (SMC).In January 1999, Anders Hejlsberg formed a team to build a new language at the time called Cool, which stood for "C-like Object Oriented Language".[16] Microsoft had considered keeping the name "Cool" as the final name of the language, but chose not to do so for trademark reasons. By the time the .NET project was publicly announced at the July 2000 Professional Developers Conference, the language had been renamed C#, and the class libraries and ASP.NET runtime had been ported to C#.
From: http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29
There is a new (as of late 2011) C# and VB compiler written by Microsoft called Roslyn which is written in C# and VB.NET respectively. Project page is here. The Roslyn compiler is written as a library that exposes a rich public API. There is a news article here about it from InfoWorld.
UPDATE:
As of April 3, 2014, Roslyn is open source under the Apache License 2.0.
Yes it was - as majority of CLR. If you want to see the internals of CLR and/or compilers I would strongly recommend Shared Source CLI from Microsoft (aka Rotor):
Microsoft Download
Wikipedia
Shared Source Internals book
But, there is actually a compiler written in C#. I believe that Mono is written that way. Download Mono sources and find out for yourself.
Related
Is it possible to transpile C# language version 10 or 11 source code to older versions of the C# language? Just like there are transpilers for Javascript to port code written in newer versions of Javascript to older versions of Javascript.
Nothing pre-rolled. Some features can be represented in down-level languages -and some tools offer similar features - for example, IIRC "Reflector" allowed you to specify the language version when decompiling IL, but: decompiled code can also frequently include things that can't actually be represented in pure C#, and: not all up-level features can be represented in down-level C#. Simple features like simple properties: sure, but: they're not hard to do manually anyway.
In most cases, however, you can use an up-level C# version on a down-level project, by using the <LangVersion> element in the csproj; for example, <LangVersion>10</LangVersion> or <LangVersion>latest</LangVersion>. This is probably the better route to explore here. Some language features demand runtime support - which makes them framework-version dependent; some language features just require specific types to exist, and will work if you define those types locally or import them as a package (for example, Microsoft.Bcl.AsyncInterfaces).
No. But that is not the important question.
C# code is compiled to CIL code, that is executed by the runtime. Some language features are "syntactic sugar" and can be used on any runtime. These can typically be used by just setting the langversion to "latest" in the project file.
Other features, like the new "generic math", require new runtime features, so it cannot be used with older runtimes. So if you want to use the new features you would essentially have to bundle the entire runtime with your application, and that is already one of the ways .Net core applications can be deployed. So just create a self contained deployment bundle.
Is it possible to write Test Complete plug-ins in C#? I see that you can write some extension for WPF controls in their documentation. However, can I write full fledged plugins? I am on version 8.5
TestComplete is a native COM-based application and, therefore, a custom plug-in should be a native dll with the COM architecture as well. Theoretically, it is possible to create it in C#, but I think that a possible result does not worth efforts. Information on the supported platforms (Visual C++ and Delphi) can be found in the Supported Development Tools article.
Please note that there are some samples included in the TestComplete SDK and some user-contributed examples for older versions of the tool:
Real-world TestComplete Plug-ins, Part I
Real-world TestComplete Plug-ins Part II
Real-world TestComplete Plug-ins Part III - Extended Colors Plug-in
Real-world TestComplete Plug-ins Part IV - ODT Declaration Generator
I guess the current API is mostly the same, for the sake of backward compatibility.
Anyone could help my why in MSDN some resources for C# are provided the list of versions (for a specific topic) as C# (1.0, 2.0, etc) and some other are provided as Visual Studio versions (2003, 2005, etc).
I've read a question and an answer provided by Jon Skeet, describes the differences but I think for example, params keyword and IEnumerable both are part of C# the language not parts of libraries in .Net.
Am I wrong?
params is a C# keyword although other .NET languages may have equivalent keywords e.g. VB.NET has ParamArray.
IEnumerable is a .NET framework interface and not C# specific.
I suspect that a lot of resources on MSDN are auto-generated by some tool, similar to SandCastle. I would imagine that this tool outputs markup that includes all of Microsoft's popular modern languages.
params is part of the C# language proper. IEnumerable is part of the .NET Framework.
Look at the downloadable Express versions of Visual Studio, and you will see that each version of C# is tightly tied to the version of Visual Studio that supports it, while the .NET Framework is treated as if it were an outside library (which, in certain ways, it is. It is language-agnostic, for example).
What is the official marketing name for C# 4?
Apress writes "Visual C# 2010 Recipes"
Apress also writes "Pro C# 2010 and the .NET 4 platform"
O'Reilly also writes "Microsoft Visual C# 2010"
Jon Skeet and Scott Hanselman both write C# 4
yet Dino Esposito writes C# 4.0
this MSDN page is entitled Visual C# 2010 Samples, refers to C# 4.0, and people writing in the comments refer to both C# 4 and C# 4.0
If we are going to publish training material about C# 4, what term should we use?
Microsoft Visual C# 2010 is the C# specific part of the integrated development environment Microsoft Visual Studio 2010.
C# 4.0 is the language.
Microsoft .NET Framework 4.0 is the framework.
It is common to shorten 4.0 to 4.
This is a response to Adrian Grigores comment "The .NET version does determine the syntax and semantics of the C# language".
There are (at least) three partially independent version numbers - the .NET Framework version, the Common Language Runtime (CLR) version, and the C# version (see this StackOverflow question for a quite comprehensive list of Framework and CLR versions).
The C# version determines what language features are available. Language features are based on .NET Framework features - the included framework assemblies and CLR version. Finally every .NET Framework versions includes a specific CLR version that basically determines what is valid Common Intermediate Language (CIL) code and how it must be interpreted. Some examples.
C# 3.0 introduces automatic properties. This feature is build into the compiler and does not rely on new functionalities in the .NET Framework assemblies or even the Common Language Runtime (the .NET Framework 3.0 still contains the CLR 2.0). Therefore it is possible to build an application using automatic properties and targeting the .NET Framework 2.0 (maybe even 1.0 and 1.1).
C# 3.0 introduces LINQ. This feature is mainly build into the compiler but partly relies on assemblies new in the .NET Framework 3.0. LINQ to Objects for example relies on the new System.Core.dll containing the Enumerable class. It is however possible to fake this dependencies and therefore use LINQ to Objects with the .NET Framework 2.0.
C# 2.0 introduces generics. This feature relies on extension of the CIL in the CLR 2.0. Therefore it is not possible to use generics with the .NET Framework 1.0 and 1.1.
I'd go with C# 4.0
The first and third book you quoted refers to the visual studio subproduct (Visual C#), That's why they are using 2010 as the "version" number.
So since you you are going to write an article about C#, not Visual Studio, It's either 4 or 4.0. And since '4.0' makes it clearer that you are talking about a version number, C# 4.0 seems like the best choice to me.
The official name of the language is Visual C# <version>
I'll look for a reference .
Edit:
The ECMA-334 standard consistently calls it C#. So that is the name of the language.
Microsoft calls their implementation Visual C#. The other implementations (that I know of) are Mono C# and Rotor C#
And while the IDE is called Visual Studio <versionyear>, I think C# 2010 is a definite misnomer. But that doesn't lower its marketing value.
While the real technical name is C# 4.0 for the latest C# version, 2010 is the IDE's version.
For marketing purposes, 2010 might be used instead of 4.0, because people new to the language might be more tempted to the year number for it indicates that the book is tackling the technology with its recent update.
I'd say the language is C# 4.0, the tool is Visual C# 2010 (like Visual C# 2010 Express).
I would opt for C#4.0.
In the past you had
.NET 1.0 (C# 1.0)
.NET 1.1 (C# 1.0)
.NET 2.0 (C# 2.0)
.NET 3.0 (C# 2.0)
.NET 3.5 (C# 3.0)
and now
.NET 4.0 (C# 4.0)
The language is C# 4.0. The product is Visual C# 2010.
C:\Users\pminaev>csc /?
Microsoft (R) Visual C# 2010 Compiler version 4.0.30319.1
and then opening "%ProgramFiles%\Microsoft Visual Studio 10.0\VC#\Specifications\1033\CSharp Language Specification.doc", on the very first page
C# Language Specification
Version 4.0
IMHO i would call it by it's version.. so C# 4.0. Previous Versions were called by the same like C# 3.0 etc.
regards
Since C# 4.0 came out and currently can only be developed in Visual Studio 2010 (and no other version of VS), people seem to use both terms interchangeably.
Personally, I would rather see C# 4.0, as that is the version of the language, not of the IDE.
Using C# 4.0 may be the official name, but especially if your book is targeted to those 'less in the know', than adding 2010 and whatnot may let people know which version of Visual Studio you are talking about. If it's for professionals, you'll have no problem throwing around C# 4, but for beginners, saying C# 2010 will tell them the IDE they need to use. It's clearer, though not official.
A recent answer to a question on converting Java to C# suggested I should use Java Language Conversion Assistant and pointed to:
http://msdn.microsoft.com/en-us/library/7tatw8a2%28VS.80%29.aspx
I cannot find JLCA on my Visual Studio (9.0.30729.1) and on looking at Wikipedia (http://en.wikipedia.org/wiki/J_Sharp) I find:
Retirement of the J# language and Java
Language Conversion Assistant from
future versions of Visual Studio,
since the existing J# feature set
largely meets customer needs and usage
of J# is declining. The last version
shipping with Visual Studio 2005 will
be supported until 2015 as per the
product life-cycle strategy.
I'd be grateful for an overview of whether I can use and should be using either J# or JLCA and if so how to install and use them.
Something that might help - there is an open source project IKVM.Net that can recompile your java bytecode into .net byte code. Afterwards, you could use Reflector to decompile the generated .net assembly into C# for additional modifications. IKVM comes with a fully converted java class library as .net assembly, which you can continue using from that code, while slowly moving to the core .net libraries.
From this and other answers it seems that J# should be deprecated.