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) { | |
// [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 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
float elapsed = ...; | |
Vector3 position = object1.Position, velocity = object1.Velocity; | |
Vector3 nextPosition = position + (velocity * elapsed); | |
GraphicsContext.DrawLine(position, nextPosition); |
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
Program.ReturnArgument = function (arg) { | |
return arg; | |
}; | |
Program.Main = function (args) { | |
var a = new CustomType(); | |
a._ctor(1); | |
var b = Program.ReturnArgument(a).MemberwiseClone(); | |
a.Value = 2; | |
System.Console.WriteLine("a={0}, b={1}", a, b); | |
b = Program.ReturnArgument(a).MemberwiseClone(); |
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
"use strict"; | |
if (typeof (JSIL) !== "undefined") | |
throw new Error("JSIL.Core included twice"); | |
var JSIL = { | |
__FullName__ : "JSIL" | |
}; | |
// Safari does not provide Function.prototype.bind, and we need it. |
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
public void RenderEntities (DrawFlags flags) { | |
if (flags == DrawFlags.None) | |
return; | |
var bounds = Camera.Bounds; | |
SpatialCollection<RuntimeEntity>.ItemInfo current; | |
using (var e = RuntimeLevel.Entities.GetItemsFromBounds(bounds)) | |
while (e.GetNext(out current)) | |
current.Item.Draw(flags); | |
} |
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
[JSReplacement("UnqualifiedTypeName")] | |
public static class MyClass { | |
public static string StringField = "StringField"; | |
public static string StringProperty { | |
get; | |
set; | |
} | |
public static string GetString () { | |
return "MyClass"; |
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
// Program | |
public static void Main(string[] args) | |
{ | |
int i = 0; | |
while (i < args.Length) | |
{ | |
string text = args[i]; | |
string text2 = text; | |
if (text2 == 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
Func<FieldDefinition, bool> isFieldIgnored = (f) => { | |
IMemberInfo memberInfo; | |
if (typeInfo.Members.TryGetValue(MemberIdentifier.New(f), out memberInfo)) | |
return memberInfo.IsIgnored; | |
else | |
return true; | |
}; | |
var structFields = | |
(from field in typedef.Fields |
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
var methodGroups = (from kvp in Members where kvp.Key.Type == MemberIdentifier.MemberType.Method | |
let m = (MethodInfo)kvp.Value | |
group m by new { | |
m.Member.Name, | |
m.Member.GenericParameters.Count, | |
m.IsStatic | |
} into mg | |
where mg.Count() > 1 | |
select mg).ToArray(); |
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 TaskFn GetEntityPlacer (string entityType) { | |
return () => { | |
PlaceEntity(GetMousePosition(true), entityType); | |
return null; | |
}; | |
} |