tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
TransformerBase{TInput,TOutput}.cs
Go to the documentation of this file.
1using System;
2using System.Linq.Expressions;
3
5{
7 abstract class TransformerBase<TInput, TOutput> : ITransformer<TInput, TOutput>
8 {
12 static Func<TInput, TOutput>? compiledExpression;
13
15 public Expression<Func<TInput, TOutput>> Expression { get; }
16
18 public Func<TInput, TOutput> CompiledExpression { get; }
19
24 protected TransformerBase(
25 Expression<Func<TInput, TOutput>> expression)
26 {
27 compiledExpression ??= expression.Compile();
28 Expression = expression;
30 }
31 }
32}
Expression< Func< TInput, TOutput > > Expression
Expression<TDelegate> form of the transformation.
static ? Func< TInput, TOutput > compiledExpression
static cache for CompiledExpression.
Func< TInput, TOutput > CompiledExpression
The compiled Expression.
TransformerBase(Expression< Func< TInput, TOutput > > expression)
Initializes a new instance of the TransformerBase<TInput, TOutput> class.
Contains a transformation Expression for converting TInput s to TOutput s.