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 class DelegateEqualityComparer<T> : IEqualityComparer<T> | |
| { | |
| private readonly Func<T, T, bool> equalityPredicate; | |
| private readonly Func<T, int> hashCodePredicate; | |
| public DelegateEqualityComparer(Func<T, T, bool> equalityPredicate) | |
| : this (equalityPredicate, 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
| namespace example | |
| { | |
| public static class EnumerableHelper | |
| { | |
| public static bool In<T>(this T testValue, params T[] testParameters) | |
| { | |
| return testValue.In((left, right) => object.Equals(left, right), testParameters); | |
| } | |
| public static bool In<T>(this T testValue, Func<T, T, bool> testFunction, params T[] testParameters) |
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
| //A METHOD TO SOLVE THE BOXING/UNBOXING OF UNKNOWN OBJECTS COMPARISONS PROBLEM | |
| //THIS IS NOT THE BEST WAY TO SOLVE THIS PROBLEM, I COULD ALSO USE A PROPER HEAP MEMORY MEMCMP BUT I'M AFRAID EVEYRONE MIGHT NOT KNOW C-LANG | |
| //IT WOULD BE NICE IF ValueType.Equals WASN'T BEING AN ASSHOLE TO PRIMITIVES | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Runtime.InteropServices; | |
| private static class PrimitiveHelper | |
| { | |
| [DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)] |
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.Collections; | |
| using System.Collections.Generic; | |
| namespace Fibonacci | |
| { | |
| public class FibonacciEnumerable : IEnumerable<ulong> | |
| { | |
| public IEnumerator<ulong> GetEnumerator() | |
| { | |
| return new FibonacciEnumerator(zeroValue: 0, firstValue: 1); |
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
| //Written by Hendrik Johann Jacobs see https://hjjacobs.com for some more of my stuff | |
| using System; | |
| using Microsoft.Extensions.Logging; | |
| namespace Example | |
| { | |
| public static class LoggerExtensions | |
| { | |
| /// <summary> | |
| /// <para>Log a unit of work, this denotes a single step within the current process and should be have an associated unit test.</para> |