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; | |
namespace Juliet | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Union3<int, char, string>[] unions = new Union3<int,char,string>[] | |
{ |
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.Generic; | |
using System.Diagnostics; | |
using System.Reflection; | |
using System.Reflection.Emit; | |
namespace DryTools | |
{ | |
public static class ExtractName | |
{ |
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 class D<T0, T1> { } | |
public class G<T0, T1> : D<int, T1> { } | |
[Test] | |
public void Get_generic_arguments_should_work_the_same_on_all_platforms() | |
{ | |
// For generic type definition Type.GetGenArgs == TypeInfo.GenPars | |
var typeGenArgs = typeof(G<,>).GetGenericArguments(); | |
var infoGenArgs = typeof(G<,>).GetTypeInfo().GenericTypeArguments; | |
var infoGenPars = typeof(G<,>).GetTypeInfo().GenericTypeParameters; |
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 FizzBuzz() | |
{ | |
var rules = new Dictionary<int, string> { { 3, "Fizz" }, { 5, "Buzz" } }; | |
Func<int, string> translate = i => | |
rules.Aggregate((string)null, (s, x) => i % x.Key == 0 ? (s == null ? x.Value : s + x.Value) : s) | |
?? i.ToString(); | |
var words = Enumerable.Range(9, 7).Select(translate).ToArray(); | |
CollectionAssert.AreEqual(new[] { "Fizz", "Buzz", "11", "Fizz", "13", "14", "FizzBuzz" }, words); |
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
let rules = [(3, "Fizz"); (5, "Buzz")] | |
let translate x = | |
None |> List.foldBack (fun (i, word) say -> | |
if x % i = 0 then Some <| Option.fold (+) word say | |
else say) rules | |
for n in 1..100 do | |
printfn "%s" <| match translate n with | Some s -> s | _ -> string n |
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.Linq; | |
using System.Threading; | |
using NUnit.Framework; | |
namespace Playground | |
{ | |
[TestFixture] | |
public class RefTests | |
{ |
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 NUnit.Framework; | |
using Microsoft.CSharp.RuntimeBinder; | |
namespace MultiMethodsWithDymanic | |
{ | |
[TestFixture] | |
public class MultimethodsTests | |
{ | |
[Test] | |
public void What_is_good_for_rabbit_is_not_good_for_wolf() |
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.Linq.Expressions; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
var p = new Program(); | |
var expr = p.GetNExpr(); |
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.Generic; | |
using System.Linq; | |
using NUnit.Framework; | |
namespace DryIoc.IssuesTests | |
{ | |
[TestFixture] | |
public class InjectListOfDepsWithStringDeps | |
{ |
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.Reflection; | |
using NUnit.Framework; | |
namespace Playground | |
{ | |
[TestFixture] | |
public class EitherTests | |
{ | |
[Test] |
OlderNewer