This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public static class Program { | |
public static void Main (string[] args) { | |
int x = 1; | |
string y = "y"; | |
Func<string> a = () => { | |
return String.Format("x={0}, y={1}", x, y); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public static class Program { | |
public static void Main (string[] args) { | |
int i = 0; | |
a: | |
i += 1; | |
Console.WriteLine("a"); | |
for (; i < 16; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class Program { | |
public static void Main (string[] args) { | |
Console.WriteLine( | |
Battlestar<object>.instance.commander | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public static class Program { | |
public static void Main (string[] args) { | |
// [y, x], not [x, y]! | |
var a = new string[5, 10]; | |
var h = a.GetLength(0); | |
var w = a.GetLength(1); | |
for (var y = 0; y < h; y++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public static class Program { | |
public static CustomType ReturnArgument (CustomType arg) { | |
return arg; | |
} | |
public static void Main (string[] args) { | |
var a = new CustomType(1); | |
var b = new CustomType(2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* The Computer Language Benchmarks Game | |
http://shootout.alioth.debian.org/ | |
contributed by Isaac Gouy, optimization and use of more C# idioms by Robert F. Tobler | |
*/ | |
using System; | |
public static class Program { | |
public static void Main () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public static class Program { | |
public enum SimpleEnum { | |
A, | |
B = 3, | |
C, | |
D = 10 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public static class Program { | |
public static void PrintNullable (int? i) { | |
if (i.HasValue) | |
Console.Write("{0} ", i.Value); | |
else | |
Console.Write("null "); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* The Computer Language Benchmarks Game | |
http://shootout.alioth.debian.org/ | |
contributed by Marek Safar | |
*/ | |
using System; | |
public static class Program { | |
const int minDepth = 4; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public interface I { | |
void Foo (); | |
} | |
public class A : I { | |
public void Foo () { | |
Console.WriteLine("A"); | |
} |
OlderNewer