惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Help Net Security
Help Net Security
G
Google Developers Blog
雷峰网
雷峰网
WordPress大学
WordPress大学
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Engineering at Meta
Engineering at Meta
Security Latest
Security Latest
T
Threat Research - Cisco Blogs
AWS News Blog
AWS News Blog
F
Full Disclosure
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Exploit Database - CXSecurity.com
J
Java Code Geeks
U
Unit 42
C
Cyber Attacks, Cyber Crime and Cyber Security
V
V2EX
C
Cisco Blogs
博客园 - 司徒正美
Project Zero
Project Zero
L
LINUX DO - 热门话题
阮一峰的网络日志
阮一峰的网络日志
Blog — PlanetScale
Blog — PlanetScale
Scott Helme
Scott Helme
A
About on SuperTechFans
Hugging Face - Blog
Hugging Face - Blog
S
Securelist
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
S
Schneier on Security
G
GRAHAM CLULEY
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyberwarzone
Cyberwarzone
MongoDB | Blog
MongoDB | Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 叶小钗
T
Threatpost
Recorded Future
Recorded Future
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
The Register - Security
The Register - Security
S
Security Archives - TechRepublic
博客园 - Franky
N
News | PayPal Newsroom
Simon Willison's Weblog
Simon Willison's Weblog
S
SegmentFault 最新的问题
W
WeLiveSecurity
A
Arctic Wolf
B
Blog

博客园 - tiny羊

自制一个可以为XNA所用的GIF 转 PNG 的小工具 展示PNG动画精灵 XNA 4.0中实现简单的快捷键模板 C#关键字 之 访问与上下文 C#关键字 之 转换 C#关键字 之 运算符 C#关键字 之 参数 - tiny羊 C#关键字 之 修饰符 Sql小题几道 泛型类及系统中常用的泛型类 泛型函数 Javascript简明教程6 定义时执行与单例模式 编程语言发展趋势图 Javascript简明教程系列 Javascript简明教程五 DOM Javascript简明教程四 作用域 Javascript简明教程三 函数 Javascript简明教程二 变量 Javascript简明教程一 使用Javascript
C#关键字 之 块
tiny羊 · 2008-10-06 · via 博客园 - tiny羊

选择语句

if(x==1){
//语句1
} else{
//语句2
}
switch(x){
case 1:  
//语句1
break;//必写
case 2:
//语句2
break;
default://其它
//语句3
break;
}

迭代语句

for(int i=0;i<100;i++){
//...
}
foreach(int i in x){
//...use i
}
int x = 0;
do{
x++;//先执行后判断
} while (x < 5);
	int n = 1;
        while (n < 6) 
        {
            n++;//先执行后判断
        }

break跳出循环

continue跳出循环的本次执行

goto跳到任意行编号

return函数返回值

yield返回一个值到一个集合

public static IEnumerable Power(int number, int exponent){
        int counter = 0;
        int result = 1;
        while (counter++ < exponent)
        {
            result = result * number;
            yield return result;
        }
    }

    static void Main()
    {
        foreach (int i in Power(2, 8))
        {
            Console.Write("{0} ", i);
        }
    }

throw 抛出异常

try-catch获取异常

try-finally解决异常

try-catch-finally上两个结合

checked检查溢出(溢出就出错)

unchecked不查(溢出自动截了)