在介绍本章之前,我们先看一下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的更多相关文章

  1. MySql数据库乱码解决方法

    MySql数据库乱码解决方法 解决乱码问题一个原则:存取系统使用一致的编码规则. 多使用mysql的原生命令行,这样才能做更多的事情. ​ 第一步: 确认应用系统需要使用的编码 java的默认编码是跟 ...

  2. CSharp 相关知识点小结

    1.JS获取iframe下面的内容document.getElementById('IFRAME1').contentDocument; 2.dialog 弹出层,定位:postion:'bottom ...

  3. 【转】Unity3D研究院之通过C#使用Advanced CSharp Messenger(五十)

    http://www.xuanyusong.com/archives/2165 Advanced CSharp Messenger 属于C#事件的一种. 维基百科中由详细的说明http://wiki. ...

  4. CSharp Similarities and Differences

    This document lists some basic differences between Nemerle and C# in a terse form. If you know Java ...

  5. Unity3D之通过C#使用Advanced CSharp Messenger

    Advanced CSharp Messenger 属于C#事件的一种. 维基百科中由详细的说明http://wiki.unity3d.com/index.php?title=Advanced_CSh ...

  6. c#操作MangoDB 之MangoDB CSharp Driver驱动详解

    序言 MangoDB CSharp Driver是c#操作mongodb的官方驱动. 官方Api文档:http://api.mongodb.org/csharp/2.2/html/R_Project_ ...

  7. Tcl internal variables

    Tcl internal variables eryar@163.com 在Tcl中内置了一些变量,并赋予了一定的功能.内置变量列表如下: 变量名称 功能描述 argc 指命令行参数的个数. argv ...

  8. c#进阶之神奇的CSharp

    CSharp 简写为c#,是一门非常年轻而又有活力的语言. CSharp的诞生      在2000年6月微软发布了c#这门新的语言.作为微软公司.NET 平台的主角,c#吸收了在他之前诞生的语言(c ...

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

随机推荐

  1. c# 可以设置透明度的 Panel 组件

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; u ...

  2. 拿nodejs快速搭建简单Oauth认证和restful API server攻略

    拿nodejs快速搭建简单Oauth认证和restful API server攻略:http://blog.csdn.net/zhaoweitco/article/details/21708955 最 ...

  3. 什么是SQLCLR与使用

    原帖地址:http://www.cnblogs.com/hsrzyn/archive/2013/05/28/1976555.html 什么是SQLCLR SQL CLR (SQL Common Lan ...

  4. C语言每日一题之No.4

    这几天老大也没安排我什么项目,于是想正好趁着空补C.当然,是利用晚上加班时间,白天正常上班时间还是学习公司的平台. 今儿个突然弱弱的感觉到在公司补C是件很低级的事情,哪怕是在加班时间都会被喷,因为大家 ...

  5. visual studio 声明数组太大,导致栈溢出

    在解释原因前我们先看一下一个由C/C++编译的程序占用的内存分为几个部分: 1.栈区(stack segment):由编译器自动分配释放,存放函数的参数的值,局部变量的值等.在Windows下,栈是向 ...

  6. 【SQL Server】系统学习之二:索引优化

    页大小8192个字节,行限制为8060字节(大型对象除外). 包含varchar nvarchar varbinary sql_variant(8012,object类型) clr 的行,如果行大小超 ...

  7. 黄聪:阿里云Windows2012服务器IIS8实现wordpress完美伪静态(ISAPIRewritev)

    1.下载64位URL重写组件:http://www.iis.net/downloads/microsoft/url-rewrite   (可以直接下载:urlrewrite2.rar) 2.暂停IIS ...

  8. 浅谈Redis数据库的键值设计(转)

    丰富的数据结构使得redis的设计非常的有趣.不像关系型数据库那样,DEV和DBA需要深度沟通,review每行sql语句,也不像memcached那样,不需要DBA的参与.redis的DBA需要熟悉 ...

  9. linux命令(12)uniq去重

    转载地址:http://blog.51yip.com/shell/1022.html 实例详细说明linux下去除重复行命令uniq 一,uniq干什么用的 文本中的重复行,基本上不是我们所要的,所以 ...

  10. 2011-2015年Journal of Mathematical Physics高引用文章

    http://aip-info.org/1XPS-45FE9-0AC9S389C5/cr.aspx