-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBridgeAbstractionImpl.cs
More file actions
37 lines (31 loc) · 1.02 KB
/
BridgeAbstractionImpl.cs
File metadata and controls
37 lines (31 loc) · 1.02 KB
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
namespace GofPatterns.Structural.BridgePattern.Implementations;
/// <summary>
/// Bridge abstraction class with single implementation.
/// </summary>
/// <typeparam name="TImplementation"></typeparam>
public class BridgeAbstractionImpl<TImplementation> : IBridgeAbstractionImpl<TImplementation>
where TImplementation : IBridgeImplementationImpl
{
public void Add(TImplementation implementation)
{
Implementation = implementation;
}
public void Execute()
{
Implementation!.Execute();
}
public TImplementation? Implementation { get; private set; }
}
public class BridgeAbstractionImpl<TImplementation, TInput> : IBridgeAbstractionImpl<TImplementation, TInput>
where TImplementation : IBridgeImplementationImpl<TInput>
{
public void Add(TImplementation implementation)
{
Implementation = implementation;
}
public void Execute(TInput input)
{
Implementation!.Execute(input);
}
public TImplementation? Implementation { get; private set; }
}