This file contains hidden or 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 hidden or 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; | |
using System.Collections; | |
using System.Collections.Generic; | |
public static class Program { | |
public static IEnumerable<int> OneToNine { | |
get { | |
for (int i = 0; i < 10; i++) | |
yield return i; | |
} |
This file contains hidden or 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
// Microsoft.Xna.Framework.Vector2 | |
public static Vector2 Transform(Vector2 value, Quaternion rotation) | |
{ | |
float num = rotation.X + rotation.X; | |
float num2 = rotation.Y + rotation.Y; | |
float num3 = rotation.Z + rotation.Z; | |
float num4 = rotation.W * num3; | |
float num5 = rotation.X * num; | |
float num6 = rotation.X * num2; | |
float num7 = rotation.Y * num2; |
This file contains hidden or 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
JSIL.MakeType = function (baseType, namespace, localName, fullName, isReferenceType) { | |
if (typeof (namespace[localName]) != "undefined") | |
throw new Error("Duplicate definition of type " + fullName); | |
var initType; | |
var ctor = function () { | |
JSIL.InitializeStructFields(this, localName); | |
if (typeof (initType) != "undefined") | |
initType(); |
This file contains hidden or 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
protected IEnumerator<object> TextureLoaderTask () { | |
var sleep = new Sleep(0.5); // Wait half a second for work items to build up. | |
var batch = new List<PendingTextureLoad>(); | |
while (true) { | |
// Pull a single work item from the queue. Our task will be put to sleep if | |
// the queue is empty. | |
{ | |
var f = TextureLoadQueue.Dequeue(); | |
yield return f; |
This file contains hidden or 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; | |
using System.Collections.Generic; | |
public static class Program { | |
public static void Main (string[] args) { | |
var array = new[] { 1, 2, 4, 8, 16 }; | |
foreach (var i in array) | |
Console.WriteLine(i); |
This file contains hidden or 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) { | |
Action<int> a = | |
(i) => Console.WriteLine("a({0})", i); | |
Action<int> b = | |
(i) => Console.WriteLine("b({0})", i); | |
Action<int> c = (Action<int>)Delegate.Combine(a, b); |
This file contains hidden or 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 Increment (ref int x) { | |
x += 1; | |
} | |
public static void Main (string[] args) { | |
Func<int, int> inc = (i) => { | |
Increment(ref i); |
This file contains hidden or 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; | |
using JSIL; | |
public static class Program { | |
public static void Main (string[] args) { | |
const string pri = "pri"; | |
string nt = "nt"; | |
var p = Builtins.Global[pri + nt] as dynamic; | |
if (p != null) |
This file contains hidden or 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); | |
}; |