@@ -41,23 +41,20 @@ public sealed class ScalarOf<T> : IScalar<T>
41
41
/// <param name="src">func to cache result from</param>
42
42
public ScalarOf ( T src ) : this ( new Live < T > ( src ) )
43
43
{ }
44
- public static ScalarOf < T > New ( T src ) => new ScalarOf < T > ( src ) ;
45
44
46
45
/// <summary>
47
46
/// A s<see cref="IScalar{T}"/> that will return the same value from a cache always.
48
47
/// </summary>
49
48
/// <param name="src">func to cache result from</param>
50
49
public ScalarOf ( Func < T > src ) : this ( new Live < T > ( src ) )
51
50
{ }
52
- public static ScalarOf < T > New ( Func < T > src ) => new ScalarOf < T > ( src ) ;
53
51
54
52
/// <summary>
55
53
/// A s<see cref="IScalar{T}"/> that will return the same value from a cache always.
56
54
/// </summary>
57
55
/// <param name="src">scalar to cache result from</param>
58
56
public ScalarOf ( IScalar < T > src ) : this ( src , input => false )
59
57
{ }
60
- public static ScalarOf < T > New ( IScalar < T > src ) => new ScalarOf < T > ( src ) ;
61
58
62
59
/// <summary>
63
60
/// A s<see cref="IScalar{T}"/> that will return the same value from a cache as long the reload condition is false.
@@ -66,7 +63,6 @@ public ScalarOf(IScalar<T> src) : this(src, input => false)
66
63
/// <param name="shouldReload">reload condition func</param>
67
64
public ScalarOf ( Func < T > srcFunc , Func < T , bool > shouldReload ) : this ( new Live < T > ( srcFunc ) , shouldReload )
68
65
{ }
69
- public static ScalarOf < T > New ( Func < T > srcFunc , Func < T , bool > shouldReload ) => new ScalarOf < T > ( srcFunc , shouldReload ) ;
70
66
71
67
/// <summary>
72
68
/// A s<see cref="IScalar{T}"/> that will return the same value from a cache as long the reload condition is false.
@@ -75,7 +71,6 @@ public ScalarOf(Func<T> srcFunc, Func<T, bool> shouldReload) : this(new Live<T>(
75
71
/// <param name="shouldReload">reload condition func</param>
76
72
public ScalarOf ( IFunc < T > srcFunc , Func < T , bool > shouldReload ) : this ( new Live < T > ( srcFunc ) , shouldReload )
77
73
{ }
78
- public static ScalarOf < T > New ( IFunc < T > srcFunc , Func < T , bool > shouldReload ) => new ScalarOf < T > ( srcFunc , shouldReload ) ;
79
74
80
75
/// <summary>
81
76
/// A s<see cref="IScalar{T}"/> that will return the same value from a cache as long the reload condition is false.
@@ -89,7 +84,6 @@ public ScalarOf(IScalar<T> src, Func<T, bool> shouldReload)
89
84
this . cache = new T [ 1 ] ;
90
85
this . filled = new bool [ 1 ] ;
91
86
}
92
- public static ScalarOf < T > New ( IScalar < T > src , Func < T , bool > shouldReload ) => new ScalarOf < T > ( src , shouldReload ) ;
93
87
94
88
/// <summary>
95
89
/// Get the value.
@@ -107,6 +101,48 @@ public T Value()
107
101
this . cache [ 0 ] = this . origin . Value ( ) ;
108
102
}
109
103
return this . cache [ 0 ] ;
110
- }
104
+ }
105
+ }
106
+
107
+ public static class ScalarOf
108
+ {
109
+ /// <summary>
110
+ /// A s<see cref="IScalar{T}"/> that will return the same value from a cache always.
111
+ /// </summary>
112
+ /// <param name="src">func to cache result from</param>
113
+ public static ScalarOf < T > New < T > ( T src ) => new ScalarOf < T > ( src ) ;
114
+
115
+ /// <summary>
116
+ /// A s<see cref="IScalar{T}"/> that will return the same value from a cache always.
117
+ /// </summary>
118
+ /// <param name="src">func to cache result from</param>
119
+ public static ScalarOf < T > New < T > ( Func < T > src ) => new ScalarOf < T > ( src ) ;
120
+
121
+ /// <summary>
122
+ /// A s<see cref="IScalar{T}"/> that will return the same value from a cache always.
123
+ /// </summary>
124
+ /// <param name="src">scalar to cache result from</param>
125
+ public static ScalarOf < T > New < T > ( IScalar < T > src ) => new ScalarOf < T > ( src ) ;
126
+
127
+ /// <summary>
128
+ /// A s<see cref="IScalar{T}"/> that will return the same value from a cache as long the reload condition is false.
129
+ /// </summary>
130
+ /// <param name="srcFunc">func to cache result from</param>
131
+ /// <param name="shouldReload">reload condition func</param>
132
+ public static ScalarOf < T > New < T > ( IFunc < T > srcFunc , Func < T , bool > shouldReload ) => new ScalarOf < T > ( srcFunc , shouldReload ) ;
133
+
134
+ /// <summary>
135
+ /// A s<see cref="IScalar{T}"/> that will return the same value from a cache as long the reload condition is false.
136
+ /// </summary>
137
+ /// <param name="srcFunc">func to cache result from</param>
138
+ /// <param name="shouldReload">reload condition func</param>
139
+ public static ScalarOf < T > New < T > ( Func < T > srcFunc , Func < T , bool > shouldReload ) => new ScalarOf < T > ( srcFunc , shouldReload ) ;
140
+
141
+ /// <summary>
142
+ /// A s<see cref="IScalar{T}"/> that will return the same value from a cache as long the reload condition is false.
143
+ /// </summary>
144
+ /// <param name="src">scalar to cache result from</param>
145
+ /// <param name="shouldReload">reload condition func</param>
146
+ public static ScalarOf < T > New < T > ( IScalar < T > src , Func < T , bool > shouldReload ) => new ScalarOf < T > ( src , shouldReload ) ;
111
147
}
112
148
}
0 commit comments