002 The Variables In Csharp
在介绍本章之前,我们先看一下C#的编译过程,如下图所示:

图片摘自:http://www.developingthefuture.net/compilation-process-and-jit-compiler/
The process of compilation in a managed environment (.Net, Java)
The process of compilation in managed environments is slightly different. Let's take .Net and Java as examples. The code we write in our favourite IDE is first checked by the IDE itself. Then, when compiled into object files and linked into dynamic/static libraries or executables, it is checked again, and finally it is checked at runtime. One common characteristic of the managed environments is that the compiler does not produce binary code, but rather intermediate meta-code, called MSIL - Microsoft Intermediate Language in .Net and Bytecode in Java.
After that, the MSIL is translated to binary code at runtime by the JIT (Just In Time) compiler, meaning that the code you write is only interpreted when it is actually used. This allows the CLR (Common Language Runtime) to precompile and optimize your code, achieving improved performance, at the cost of increased startup time. But you can also precompile your application using Ngen (Native Image Generator) to speed up the startup, without the benefits of runtime optimization.
C#是静态类型的语言,需要编译,所以我在使用变量前必须告诉编译器变量的类型。我们使用如下所示的语法定义变量:
int a = ; //定义一个整数类型的变量a
float b = 1f;//定义一个float类型的变量b
char c= 'a';//定义一个字符类型的变量c
string str= "gavinsun";//定义一个字符串类型的变量str
bool isTrue= true;//定义一个bool类型的变量isTrue
002 The Variables In Csharp的更多相关文章
- MySql数据库乱码解决方法
MySql数据库乱码解决方法 解决乱码问题一个原则:存取系统使用一致的编码规则. 多使用mysql的原生命令行,这样才能做更多的事情. 第一步: 确认应用系统需要使用的编码 java的默认编码是跟 ...
- CSharp 相关知识点小结
1.JS获取iframe下面的内容document.getElementById('IFRAME1').contentDocument; 2.dialog 弹出层,定位:postion:'bottom ...
- 【转】Unity3D研究院之通过C#使用Advanced CSharp Messenger(五十)
http://www.xuanyusong.com/archives/2165 Advanced CSharp Messenger 属于C#事件的一种. 维基百科中由详细的说明http://wiki. ...
- CSharp Similarities and Differences
This document lists some basic differences between Nemerle and C# in a terse form. If you know Java ...
- Unity3D之通过C#使用Advanced CSharp Messenger
Advanced CSharp Messenger 属于C#事件的一种. 维基百科中由详细的说明http://wiki.unity3d.com/index.php?title=Advanced_CSh ...
- c#操作MangoDB 之MangoDB CSharp Driver驱动详解
序言 MangoDB CSharp Driver是c#操作mongodb的官方驱动. 官方Api文档:http://api.mongodb.org/csharp/2.2/html/R_Project_ ...
- Tcl internal variables
Tcl internal variables eryar@163.com 在Tcl中内置了一些变量,并赋予了一定的功能.内置变量列表如下: 变量名称 功能描述 argc 指命令行参数的个数. argv ...
- c#进阶之神奇的CSharp
CSharp 简写为c#,是一门非常年轻而又有活力的语言. CSharp的诞生 在2000年6月微软发布了c#这门新的语言.作为微软公司.NET 平台的主角,c#吸收了在他之前诞生的语言(c ...
- [Project Name] was compiled with optimization - stepping may behave oddly; variables may not be available.
控制台输出的时候显示一串这样的信息:[Project Name] was compiled with optimization - stepping may behave oddly; variabl ...
随机推荐
- MS CRM 2011的自定义和开发(11)——插件(plugin)开发(三)
http://www.cnblogs.com/StoneGarden/archive/2012/02/06/2340661.html MS CRM 2011的自定义和开发(11)——插件(plugin ...
- 程序员书单_java学习基础编程篇
Java程序设计语言.(美国)阿诺德.清晰版 http://download.csdn.net/detail/shenzhq1980/9076093 JAVA2核心技术第1卷.基础知识7th.part ...
- python主要用来做什么
python这门编程语言在国外极受欢迎,但在国内使用还不是极普遍. 由于python编程效率极高,现在国内的使用者也开始变得越来越多. python主要用来做什么?这个语言到底有哪些作用呢? 下面主是 ...
- Import SHA2 SSL cert to Windows IIS7
Import SHA2 SSL cert to Windows IIS7 1.You will get 3 piece of certs from GeoTrust, and save them to ...
- 程序包com.sun.image.codec.jpeg不存在 问题的完美解决
原文地址:http://my.oschina.net/zb0423/blog/86507 在使用Hudson进行打包的过程中,因为我们使用了一个pdf文件产生缩略图的功能,倒置添加的源码文件在mave ...
- 如何缩短SQL Server 的启动时间
将/nosplash添加到SQLServer Manageement Studio的快捷方式可以缩短启动时间.为此,右击SSMS快捷方式(位于你的桌面上.start菜单中或任务栏中)并选择Proper ...
- ubuntu双网卡bonding配置(转)
1.安装软件 apt-get install ifenslave 2.修改配置文件 /etc/network/interfaces auto lo iface lo inet loopback ifa ...
- (WPF, MVVM) Textbox Binding
参考:http://msdn.microsoft.com/en-us/library/system.windows.data.updatesourcetrigger(v=vs.110).aspx Te ...
- [CSS]如何正确使用ID和Class?
作者:DarkZone链接:https://www.zhihu.com/question/19550864/answer/23440690来源:知乎 以下摘自<精通CSS:高级Web标准解决方案 ...
- PLSQL_性能优化系列18_Oracle Explain Plan解析计划通过Baseline绑定
2015-05-28 Created By BaoXinjian