I know its extensive topic but I have failed to find some basic overview. I would like to know what is exactly the relation between these two. I know I need .NET SP2 to work with VS 2010, so client PC will need to have the same version of .NET I guess. I would be very grateful if someone could tell me in a few sentences what is .NET and how 开发者_StackOverflowit relates ti C#
.NET is a framework. What that means is that the .NET platform contains libraries of existing code and architecture from which all applications utilizing it build from. So rather than pouring a new foundation for every house, you already start off with a solid one that has been perfected and improved upon over time. In addition to a starting foundation, the framework serves as a sort of toolbox of existing code that saves you from reinventing the wheel every time you need certain things.
For instance, winforms is an established foundation from which to build windows applications with a rudimentary user interface simply by going to file > new project. You would have to interface with GDI yourself to generate windows forms and user interface if this library of existing code was not there to support you.
C# is simply a programming language. One specifically written with .NET in mind. In fact, most of the .NET framework is written in C# (if not all of it). It's syntax is simply the next progression of the C language, thus transitioning from C++ to C# shouldn't be too difficult. It's a paradigm shift with a lot of things, but at least the syntax is often familiar. Any .NET language is usually compatible with other .NET languages. For instance, I could write a class library in Visual Basic, and you could use that compiled library in your C# program.
Because .NET is a framework, the code you reference in it does not get compiled into your program, rather a reference to code in the framework is all that gets compiled. This means that clients running your program must also have the .NET framework, albeit a stripped down version. They don't need all the development tools that you need so their .NET framework download is a little smaller. Clients running Windows Vista/7 don't need to worry about anything; it's included with their OS. Only certain users running XP would even have to worry about downloading the framework, and most programs accurately detect the requirement and inform the end user to go download it.
All versions of Visual Studio are simply tools to help you build applications and better utilize the .NET framework. I would never recommend coding in any .NET language without at least the express (free) edition of visual studio. Intellisense alone is worth it. That said, it is definitely possible to code something in .NET without the Visual Studio IDE. You could open up notepad right now and write a C# program, compile it with the free compiler, and run it. While Visual Studio 2010 is pretty amazing, and uses the new WPF platform to run, 2008 will serve you just as well. 2010 is optimized for .NET 4 but works just fine when targeting previous versions of .NET as well.
Bottom line:
- .NET is a coding framework.
- C# is a language built to take advantage of .NET. NOTE: Visual Basic is also a .NET language and choosing between C# and VB is simply a matter of preference.
- Visual Studio is a tool to help you in coding for .NET.
That is how they are all related.
(This is probably a duplicate, but the best answer is off-site)
Quoting from Jon Skeet:
Untangling the Versions
There are lots of different versions of different elements of development. You need to distinguish between the versions of Visual Studio (the IDE), C# (the language) and .NET (the framework). It's quite hard to talk about each of these individually without bringing in other pieces, but I'll see what I can do... Note that I'll avoid introducing the CLR versions as well, as most developers don't really need to know about that.
.NET Framework versions
There have been five significant releases of the .NET Framework, excluding service packs. The framework includes the compilers, runtime, and libraries.
- 1.0 - released in 2002
- 1.1 - released in 2003
- 2.0 - released in 2005, with a new CLR (to handle generics and nullable types) and compilers for C# 2 and VB 8.
- 3.0 - released in 2006, this is just 2.0 plus new libraries: Windows Presentation Foundation, Windows Communication Foundation, Workflow Foundation, and Cardspace
- 3.5 - released in 2007, this is 3.0 plus new libraries (primarily LINQ and some extra "base" libraries such as TimeZoneInfo) and new compilers (for C# 3 and VB 9)
C# language versions
There are three significant language versions:
- C# 1
- C# 2, introducing generics, nullable types, anonymous methods, iterator blocks and some other more minor features
- C# 3, introducing implicit typing, object and collection initializers, anonymous types, automatic properties, lambda expressions, extension methods, query expressions and some other minor features
Read the rest here: http://csharpindepth.com/Articles/Chapter1/Versions.aspx
Basically:
- .NET is a programming environment including, among other things, a virtual machine (the CLR) and an extensive class library (the BCL)
- C# is a programming langage that targets the .NET environment. It is compiled to IL (a kind of assembly language executed by the CLR), and uses the classes from the BCL
The information HERE might be helpful to you.
C# is a programming language, very similiar to c++. .NET is a set of libraries, classes, ready to use methods etc. It is strictly related to C#. You use them both without noticing it :)
Every 'using' statement imports a set of classes to your project from .NET.
As Chevex says .NET is a framework and C# is just one of several languages targeting the framework.
Not sure about what you mean about "SP2" and VS2010. The language features you use will determine what version of the framework is required on the clients running your code.
See here for more information:
http://msdn.microsoft.com/en-us/library/bb822049.aspx
http://msdn.microsoft.com/en-us/library/8z6watww.aspx
精彩评论