forked from mikehadlow/FunctionalDemo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Explain.cs
57 lines (44 loc) · 1.09 KB
/
Explain.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;
namespace FunctionalDemo
{
public static class Explain
{
public static void Composition()
{
var dependency = new Dependency();
var thing = new Thing(dependency);
var relyOnThing = new RelyOnThing(thing);
}
}
public interface IThing
{
void Do(string arg);
}
public class Thing : IThing
{
public Thing(IDependency dependency)
{
}
public void Do(string arg)
{
}
}
public class RelyOnThing
{
public RelyOnThing(IThing thing)
{
}
}
public interface IDependency { }
public class Dependency : IDependency { }
public static class Module
{
public static void Composition()
{
var dependency = new Dependency();
Action relyOnThing = () => RelyOnThing(arg => DoThing(dependency, arg));
}
public static void DoThing(IDependency dependency, string arg) { }
public static void RelyOnThing(Action<string> thing) { }
}
}