You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -16,16 +19,30 @@ public sealed class AsyncAtomicFactory<K, V>
16
19
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
17
20
privateVvalue;
18
21
22
+
/// <summary>
23
+
/// Initializes a new instance of the <see cref="AsyncAtomicFactory{K, V}"/> class.
24
+
/// </summary>
19
25
publicAsyncAtomicFactory()
20
26
{
21
27
initializer=newInitializer();
22
28
}
23
29
30
+
/// <summary>
31
+
/// Initializes a new instance of the <see cref="AsyncAtomicFactory{K, V}"/> class with the
32
+
/// specified value.
33
+
/// </summary>
34
+
/// <param name="value">The value.</param>
24
35
publicAsyncAtomicFactory(Vvalue)
25
36
{
26
37
this.value=value;
27
38
}
28
39
40
+
/// <summary>
41
+
/// Gets the value. If <see cref="IsValueCreated"/> is false, calling <see cref="GetValueAsync"/> will force initialization via the <paramref name="valueFactory"/> parameter.
42
+
/// </summary>
43
+
/// <param name="key">The key associated with the value.</param>
44
+
/// <param name="valueFactory">The value factory to use to create the value when it is not initialized.</param>
@@ -16,16 +18,30 @@ public sealed class AtomicFactory<K, V>
16
18
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
17
19
privateVvalue;
18
20
21
+
/// <summary>
22
+
/// Initializes a new instance of the <see cref="AtomicFactory{K, V}"/> class.
23
+
/// </summary>
19
24
publicAtomicFactory()
20
25
{
21
26
initializer=newInitializer();
22
27
}
23
28
29
+
/// <summary>
30
+
/// Initializes a new instance of the <see cref="AtomicFactory{K, V}"/> class with the
31
+
/// specified value.
32
+
/// </summary>
33
+
/// <param name="value">The value.</param>
24
34
publicAtomicFactory(Vvalue)
25
35
{
26
36
this.value=value;
27
37
}
28
38
39
+
/// <summary>
40
+
/// Gets the value. If <see cref="IsValueCreated"/> is false, calling <see cref="GetValue"/> will force initialization via the <paramref name="valueFactory"/> parameter.
41
+
/// </summary>
42
+
/// <param name="key">The key associated with the value.</param>
43
+
/// <param name="valueFactory">The value factory to use to create the value when it is not initialized.</param>
44
+
/// <returns>The value.</returns>
29
45
publicVGetValue(Kkey,Func<K,V>valueFactory)
30
46
{
31
47
if(initializer==null)
@@ -36,8 +52,14 @@ public V GetValue(K key, Func<K, V> valueFactory)
36
52
returnCreateValue(key,valueFactory);
37
53
}
38
54
55
+
/// <summary>
56
+
/// Gets a value indicating whether the value has been initialized.
57
+
/// </summary>
39
58
publicboolIsValueCreated=>initializer==null;
40
59
60
+
/// <summary>
61
+
/// Gets the value if it has been initialized, else default.
/// Initializes a new instance of the <see cref="ScopedAsyncAtomicFactory{K, V}"/> class.
22
+
/// </summary>
14
23
publicScopedAsyncAtomicFactory()
15
24
{
16
25
initializer=newInitializer();
17
26
}
18
27
28
+
/// <summary>
29
+
/// Initializes a new instance of the <see cref="ScopedAsyncAtomicFactory{K, V}"/> class with the
30
+
/// specified value.
31
+
/// </summary>
32
+
/// <param name="value">The value.</param>
19
33
publicScopedAsyncAtomicFactory(Vvalue)
20
34
{
21
35
scope=newScoped<V>(value);
22
36
}
23
37
38
+
/// <summary>
39
+
/// Gets the scope if it has been initialized, else default.
40
+
/// </summary>
24
41
publicScoped<V>ScopeIfCreated
25
42
{
26
43
get
@@ -34,6 +51,12 @@ public Scoped<V> ScopeIfCreated
34
51
}
35
52
}
36
53
54
+
/// <summary>
55
+
/// Attempts to create a lifetime for the scoped value. The lifetime guarantees the value is alive until
56
+
/// the lifetime is disposed.
57
+
/// </summary>
58
+
/// <param name="lifetime">When this method returns, contains the Lifetime that was created, or the default value of the type if the operation failed.</param>
59
+
/// <returns>true if the Lifetime was created; otherwise false.</returns>
0 commit comments