What is the difference between C# and .NET?

In addition to what Andrew said, it is worth noting that:

  • .NET isn't just a library, but also a runtime for executing applications.
  • The knowledge of C# implies some knowledge of .NET (because the C# object model corresponds to the .NET object model and you can do something interesting in C# just by using .NET libraries). The opposite isn't necessarily true as you can use other languages to write .NET applications.

The distinction between a language, a runtime, and a library is more strict in .NET/C# than for example in C++, where the language specification also includes some basic library functions. The C# specification says only a very little about the environment (basically, that it should contain some types such as int, but that's more or less all).

C# and .NET relation

.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.

Relationship between C#, .NET, ASP, ASP.NET etc

I understand your confusion, believe me I have the same perspective when it comes to the Java world! Anyway I'll attempt to break your questions down and tackle them one by one... as well as add some other points in that will hopefully help clarify what's going on:

  1. C# and C#.NET are the same thing... C#
  2. .NET is, as you say, a library of code that .NET languages can talk to.
  3. .NET languages come in different flavours such as: C#.NET, VB.NET, Managed C++, F#.
  4. .NET languages compile to CIL (Common Intermediate Language) which means they all start "talking" the same language and can therefore interoperate.
  5. ASP.NET is the portion of the .NET library used for making web sites. There are other subsections of ASP.NET like WebForms (the old way of making web pages) or the rapidly maturing MVC library that are worth looking at too.
  6. Forms (old tech) or the new WPF (Windows Presentation Foundation) are the technologies you'd typically use in .NET to create what you know as traditional desktop applications.

One final thing I'd like to finish on is the difference between library and framework. In recent years these two terms have been used as those synonymous, however that is not the case. The easiest way I can think to differentiate the two is:

  • A library contains many pieces of functionality that you may pick and choose from i.e. using one piece of technology doesn't mean you're locked into the rest. This means freedom, however you will have more work cut out for you.
  • A framework however very much sets out how you will be working be providing a workflow that for better or worse is hard to change. This means rapid development/prototyping, but if significant changes are made in the future it may be impossible (or very time consuming) to implement them.

The project you're working on will depend on which choice you make.

C#和.net之间的关系的更多相关文章

  1. .NET Core与.NET Framework、Mono之间的关系

    随着微软的.NET开源的推进,现在在.NET的实现上有了三个.NET Framework,Mono和.NET Core.经常被问起Mono的稳定性怎么样,后续Mono的前景如何,要回答这个问题就需要搞 ...

  2. .NET Core 和 .NET Framework 之间的关系

    引用一段描述:Understanding the relationship between .NET Core and the .NET Framework. .NET Core and the .N ...

  3. 实体之间的关系【Entity Relationships】(EF基础系列篇9)

    Here, you will learn how entity framework manages the relationships between entities. Entity framewo ...

  4. php CGI、Fastcgi、PHP-FPM的详细介绍与之间的关系

    以下PHP CGI.Fastcgi.PHP-FPM的一些信息归纳和汇总----->详细介绍与之间的关系 一:CGI是干嘛的?CGI是为了保证web server传递过来的数据是标准格式的 web ...

  5. [转] valuestack,stackContext,ActionContext.之间的关系

    三者之间的关系如下图所示: ActionContext  一次Action调用都会创建一个ActionContext  调用:ActionContext context = ActionContext ...

  6. angular源码阅读,依赖注入的原理:injector,provider,module之间的关系。

    最开始使用angular的时候,总是觉得它的依赖注入方式非常神奇. 如果你跳槽的时候对新公司说,我曾经使用过angular,那他们肯定会问你angular的依赖注入原理是什么? 这篇博客其实是angu ...

  7. JavaScript和Java之间的关系

    今天来简单而又详细地说说JavaScript和Java的关系. 开门见山总结性一句话,它们之间的关系 = 雷锋和雷峰塔之间的关系,换句话说:它们之间没什么关系. 但往往有不少初学者甚至中级者认为它们之 ...

  8. PHP类和对象之间的关系

    类是对象的描述: 类和对象之间的关系类似于建房子的图纸和房子: 创建类--new对象--用对象: 一.对象的两个特性: --对象的行为(功能):可以对对象施加操作,例如,电视机的开.关.转换频道: - ...

  9. 关于计算机的ID和用户ID之间的关系

    关于计算机的ID和用户ID之间的关系 计算机安装完系统后就会生成计算机ID,然后系统会以计算机ID为前缀附加数字创建Administrator(500)和Guest(501)用户ID,其他用户的ID将 ...

  10. 谈谈Activiti中流程对象之间的关系

    详细见:http://www.kafeitu.me/activiti/2012/03/22/workflow-activiti-action.html (咖啡兔好牛!) 详细见: http://blo ...

随机推荐

  1. java将多个连续的空格转化成一个空格

    java将多个连续的空格转化成一个空格: System.out.println("a a".replaceAll(" + ", " ")); ...

  2. JavaScript异步获取数据解析

    <script type="text/javascript">    var xhr=false;    function createXhr() {    var x ...

  3. 使用GruntJS构建Web程序

    Gruntjs是JavaScript项目的构建工具,也是基于node的一个命令行工具.很多开源JS项目都是使用它搭建.如jQuery.Qunit.CanJS等.它有以下作用 合并JS文件 压缩JS文件 ...

  4. JSONP 含jquery 实例

     前言: 由于Sencha Touch 2这种开发模式的特性,基本决定了它原生的数据交互行为几乎只能通过AJAX来实现. 当然了,通过调用强大的PhoneGap插件然后打包,你可以实现100%的Soc ...

  5. phpstorm配置取消掉63342

    http://ask.csdn.net/questions/171665

  6. 关于yum与源码安装的LAMP或LNMP网页直接显示空白页的问题?

    学习LAMP.LNMP时,遇到很奇怪的问题就是:搭建完LAMP或LNMP环境后安装PHPweb程序时,Discuz和Wordpress打不开安装向导,直接显示空白页(PHPWind9.0除外),没有任 ...

  7. ARM-Linux S5PV210 UART驱动(5)----串口的open操作(tty_open、uart_open)

    串口驱动初始化后,串口作为字符驱动也已经注册到系统了,/dev目录下也有设备文件节点了. 那接下来uart的操作是如何进行的呢? 操作硬件之前都是要先open设备,先来分析下这里的open函数具体做了 ...

  8. ueditor使用中的坑

    项目中要使用富文本编辑于是采用了百度的开源富文本编辑器 ueditor    官网 http://ueditor.baidu.com/website/ 使用方法就按照官方的来的. 经过使用记录以下要点 ...

  9. Sharing

    To store English words, one method is to use linked lists and store a word letter by letter. To save ...

  10. 洛谷 P1858 多人背包

    求01背包前k优解的价值和 输入输出格式 Input/output 输入格式:第一行三个数K.V.N(k<=50,v<=5000,n<=200)接下来每行两个数,表示体积和价值输出格 ...