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; | |
using System.Collections.Concurrent; | |
using System.Text; | |
internal static class StringBuilderPool | |
{ | |
private static readonly ConcurrentQueue<PooledStringBuilder> Cache = new ConcurrentQueue<PooledStringBuilder>(); | |
internal static PooledStringBuilder Borrow() | |
{ |
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
namespace Meh | |
{ | |
using System; | |
using System.ComponentModel; | |
using System.Globalization; | |
using System.Text.RegularExpressions; | |
using System.Windows; | |
public struct Angle : IEquatable<Angle> | |
{ |
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
public struct Temperature : IEquatable<Temperature> | |
{ | |
public Temperature(double celcius) | |
{ | |
this.Celcius = celcius; | |
} | |
public double Celcius { get; } | |
public static bool operator ==(Temperature left, Temperature right) |
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; | |
using System.Collections.Concurrent; | |
using System.Collections.Generic; | |
using System.Reflection; | |
using System.Reflection.Emit; | |
public delegate TResult PropertyPath<in T, out TResult>(T arg); | |
public static class PropertyPathExt | |
{ |
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
/// <summary> | |
/// Allows using <see cref="IInject{T}"/> and explicit implementation of interfacemethods with [Inject] | |
/// </summary> | |
public class CustomKernel : StandardKernel | |
{ | |
public CustomKernel(INinjectSettings settings, params INinjectModule[] modules) | |
: base(settings, modules) | |
{ | |
} |
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
internal static class FormatString | |
{ | |
private static readonly IReadOnlyList<string> Empty = new string[0]; | |
private static readonly ThreadLocal<SortedSet<int>> Indexes = new ThreadLocal<SortedSet<int>>(() => new SortedSet<int>()); | |
/// <summary> | |
/// Call with "first: {0}, second {1} returns new []{"0", "1"}; | |
/// </summary> | |
/// <param name="format">The format string</param> | |
/// <returns>An unordered list of format items found in <paramref name="format"/></returns> |
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
[MarkupExtensionReturnType(typeof(IValueConverter))] | |
public class BooleanToVisibilityConverter : MarkupExtension, IValueConverter | |
{ | |
public Visibility WhenTrue { get; set; } = Visibility.Visible; | |
public Visibility WhenFalse { get; set; } = Visibility.Collapsed; | |
public Visibility WhenNull { get; set; } = Visibility.Collapsed; | |
public override object ProvideValue(IServiceProvider serviceProvider) |
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
[Test] | |
public void SomeTest() | |
{ | |
var ioc = new TestIoC(); | |
var orderService = ioc.Get<OrderService>(); | |
... | |
} |
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; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
internal static partial class Ensure | |
{ | |
[JetBrains.Annotations.ContractAnnotation("halt <= value:null")] | |
internal static void NotNullOrEmpty<T>(IEnumerable<T> value, string parameterName) |
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
IObservable<T> RepeatAfterDelay<T>(this IObservable<T> source, TimeSpan delay, IScheduler scheduler) | |
{ | |
var delay = Observable.Empty<T>().Delay(delay, scheduler); | |
return Observable.Concat(source, delay).Repeat(); | |
} | |
https://github.com/bman654 | |
Observable<Unit> AsObservable(this CancellationToken token) |