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 ...
随机推荐
- HTML 元素
HTML 文档是由 HTML 元素定义的. HTML 元素 HTML 元素指的是从开始标签(start tag)到结束标签(end tag)的所有代码. 开始标签 元素内容 结束标签 <p> ...
- 剑指offer系列45---和为s的两个数字
[题目]输入一个递增排序的数组和一个数字S,在数组中查找两个数,使得他们的和正好是S, package com.exe9.offer; /** * [题目]输入一个递增排序的数组和一个数字S,在数组中 ...
- Tortoise SVN Clean up失败的解决方法
step1: 到 sqlite官网 (http://www.sqlite.org/download.html) 下载 sqlite3.exe (找到 Precompiled Binaries for ...
- Configure custom SSL certificate for RDP on Windows Server 2012 in Remote Administration mode
Q: So the release of Windows Server 2012 has removed a lot of the old Remote Desktop related configu ...
- poj2352消防站
题目大意:有n个点的一棵树,每个点有两个值:w和c.现在要在其中若干点建立消防站,使得每个点到最近的消防站的距离不超过该点的c值,i点建立消防站的费用为w.求最小费用. 分析:本题显然是树型Dp.定义 ...
- 一个快速、完善的Android开发框架整合实践(QuickAndroid)
https://github.com/alafighting/QuickAndroid QuickAndroid 一个快速.完善的Android开发框架整合实践 QA项目简介 本框架QuickAndr ...
- PL/SQL中查看列注释、列属性
- [实变函数]5.6 Lebesgue 积分的几何意义 $\bullet$ Fubini 定理
1 本节推广数学分析中的 Fubini 定理. 为此, 先引入 (1)(从低到高) 对 $A\subset \bbR^p, B\subset\bbR^q$, $$\bex A\times B=\sed ...
- unix 中 ps -ef命令详解
ps -ef 查看正在活动的进程 ps -ef |grep abc 查看含有"abc"的活动进程 ps -ef |grep -v abc 查看不含abc的活动进程 1)ps a 显 ...
- ylbtech-dbs:ylbtech-6,record(生活记录)
ylbtech-dbs:ylbtech-6,record(生活记录) -- =============================================-- DatabaseName:R ...