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. redis学习系列

    redis学习系列 基本看完 最近在看redis的代码,简单记录下自己认为重要的点,自己写比较费时间的,我会把查到的资料贴出来方便查看 淘宝的redis内存分析 http://www.searchtb ...

  2. python(三)一个文件读写操作的小程序

    我们要实现一个文件读写操作的小程序 首先我们有一个文件 我们要以"============"为界限,每一个角色分割成一个独立的txt文件,按照分割线走的话是分成 xiaoNa_1. ...

  3. Laravel框架数据库CURD操作、连贯操作总结

    这篇文章主要介绍了Laravel框架数据库CURD操作.连贯操作.链式操作总结,本文包含大量数据库操作常用方法,需要的朋友可以参考下 一.Selects 检索表中的所有行 复制代码代码如下: $use ...

  4. Linux进程间通信IPC学习笔记之有名管道

    基础知识: 有名管道,FIFO先进先出,它是一个单向(半双工)的数据流,不同于管道的是:是最初的Unix IPC形式,可追溯到1973年的Unix第3版.使用其应注意两点: 1)有一个与路径名关联的名 ...

  5. 删除_desktop.ini病毒文件

    del h:\_desktop.ini /f/s/q/a/f 强制删除只读文件/s 从当前目录及其所有子目录栓出指定文件.显示正在删除的文件名/q 制定清音状态.不提示确认删除/a 按照属性来删除

  6. 1011. World Cup Betting (20)(最大值)

    With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excite ...

  7. 黑马程序员 SaveFileDialog的跨线程调用 (专题三)

    <a href="http://edu.csdn.net"target="blank">ASP.Net+Android+IO开发S</a> ...

  8. 第一个js库文件

    <!DOCTYPE html> <html xmlns=;         ;                     }                 };     })(); ...

  9. 关于Oracle数据库中SQL空值排序的问题

    在Oracle中进行查询排序时,如果排序字段里面有空值的情况下,排序结果可能会达不到自己想要的结果.   如 select * from tableTest order by VISITS desc ...

  10. 简单3d RPG游戏 之 004 攻击(一)

    功能:实现点击键盘F键,怪物血量条减少,并且假定是近战,需要对距离进行判断,距离小于一定值的时候按F才会减少怪物的血条. 新建c#脚本PlayerAttack,绑定到Player,并在unity里将敌 ...