public void MinTypeBuilderInstance() { for (int i = 0; i < Count; i++) { HInt32 x = _a[i], y = _b[i]; _c[i] = _lessThanTypeBuilderInstance(x, y) ? x : y; } }
public void MinTbExpression() { for (int i = 0; i < Count; i++) { HInt32 x = _a[i], y = _b[i]; _c[i] = _lessThanTbExpression(x, y) ? x : y; } }
public void MinDynamicMethod() { for (int i = 0; i < Count; i++) { HInt32 x = _a[i], y = _b[i]; _c[i] = _lessThanDynamicMethod(x, y) ? x : y; } }
public void MinDynamicMethodAssociatedInstance() { for (int i = 0; i < Count; i++) { HInt32 x = _a[i], y = _b[i]; _c[i] = _lessThanDynamicMethodAssociatedInstance(x, y) ? x : y; } }
public void MinHardcoded() { for (int i = 0; i < Count; i++) { HInt32 x = _a[i], y = _b[i]; _c[i] = x.Value < y.Value ? x : y; } }
public void MinMethod() { for (int i = 0; i < Count; i++) { HInt32 x = _a[i], y = _b[i]; _c[i] = LessThan(x, y) ? x : y; } }
public void MinInstanceDelegate() { for (int i = 0; i < Count; i++) { HInt32 x = _a[i], y = _b[i]; _c[i] = _lessThanInstanceDelegate(x, y) ? x : y; } }
public void Setup() { var rnd = new Random(0); _a = new HInt32[Count]; _b = new HInt32[Count]; _c = new HInt32[Count]; for (int i = 0; i < Count; i++) { _a[i] = new HInt32(rnd.Next()); _b[i] = new HInt32(rnd.Next()); } }
public void TestDelegates() { var a1 = new HInt32(1); var a2 = new HInt32(2); Assert.True(_lessThanDelegate(a1, a2)); Assert.True(_lessThanInstanceDelegate(a1, a2)); Assert.True(_lessThanExpression(a1, a2)); Assert.True(_lessThanDynamicMethod(a1, a2)); Assert.True(_lessThanDynamicMethodAssociated(a1, a2)); Assert.True(_lessThanDynamicMethodAssociatedInstance(a1, a2)); Assert.True(_lessThanTypeBuilder(a1, a2)); Assert.True(_lessThanTypeBuilderInstance(a1, a2)); Assert.True(_lessThanTbExpression(a1, a2)); }
private bool LessThanInstance(HInt32 a, HInt32 b) => a.Value < b.Value;
private static bool LessThan(HInt32 a, HInt32 b) => a.Value < b.Value;