Skip to content

Instantly share code, notes, and snippets.

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()
{
namespace Meh
{
using System;
using System.ComponentModel;
using System.Globalization;
using System.Text.RegularExpressions;
using System.Windows;
public struct Angle : IEquatable<Angle>
{
public struct Temperature : IEquatable<Temperature>
{
public Temperature(double celcius)
{
this.Celcius = celcius;
}
public double Celcius { get; }
public static bool operator ==(Temperature left, Temperature right)
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
{
/// <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)
{
}
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>
[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)
[Test]
public void SomeTest()
{
var ioc = new TestIoC();
var orderService = ioc.Get<OrderService>();
...
}
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)
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)