X hits on this document

1061 views

0 shares

0 downloads

0 comments

23 / 396

C# LANGUAGE SPECIFICATION

for statement

static void Main(string[] args) { for (int i = 0; i < args.Length; i++) { Console.WriteLine(args[i]); } }

foreach statement

static void Main(string[] args) { foreach (string s in args) { Console.WriteLine(s); } }

break statement

static void Main() { while (true) { string s = Console.ReadLine(); if (s == null) break; Console.WriteLine(s); } }

continue statement

static void Main(string[] args) { for (int i = 0; i < args.Length; i++) { if (args[i].StartsWith("/")) continue; Console.WriteLine(args[i]); } }

goto statement

static void Main(string[] args) { int i = 0; goto check; loop: Console.WriteLine(args[i++]); check: if (i < args.Length) goto loop; }

return statement

static int Add(int a, int b) { return a + b; }

static void Main() { Console.WriteLine(Add(1, 2)); return; }

10Copyright Microsoft Corporation 1999-2003. All Rights Reserved.

Document info
Document views1061
Page views1061
Page last viewedSat Dec 10 18:41:41 UTC 2016
Pages396
Paragraphs9401
Words133190

Comments