.Net Polly – transient exception handling

Polly is a .Net library that allows the expression of transient exception handling policies and implement common patterns such as: Retry, Retry Forever, Wait and Retry or Circuit Breaker all through a fluent API. Polly is available on GitHub at: Polly.

.Net extract digits from a string

Here’s how we can extract digits from a string:

public static string ExtractDigits(string input)
{
    return new String(input.Where(x => x >= '0' && x <= '9').ToArray());
}

.Net class inheritance

Quick demo to show class inheritance:

using System;

namespace ConstructorTest
{
    class Program
    {
        static void Main(string[] args)
        {
            var tester = new C();
            Console.ReadKey();
        }
    }

    public class A
    {
        public A(string input)
        {
            Console.WriteLine("From A " + input);
        }
    }

    public class B : A
    {
        public B(string input)
            : base("From B")
        {
            Console.WriteLine("From B " + input);
        }
    }

    public class C : B
    {
        public C()
            : base("From C")
        {
            Console.WriteLine("From C");
        }
    }
}