Changes HasValue in Cachable to constructor argument

This commit is contained in:
Sindre G. Langhus
2017-02-21 22:11:48 +09:00
parent d8682a82b2
commit ab60f63511
2 changed files with 16 additions and 9 deletions

View File

@@ -16,7 +16,7 @@ namespace Discord
/// <summary>
/// Is this entity cached?
/// </summary>
public bool HasValue => !EqualityComparer<TEntity>.Default.Equals(Value, default(TEntity));
public bool HasValue { get; }
/// <summary>
/// The ID of this entity.
/// </summary>
@@ -30,10 +30,11 @@ namespace Discord
public TEntity Value { get; }
private Func<Task<TEntity>> DownloadFunc { get; }
internal Cacheable(TEntity value, TId id, Func<Task<TEntity>> downloadFunc)
internal Cacheable(TEntity value, TId id, bool hasValue , Func<Task<TEntity>> downloadFunc)
{
Value = value;
Id = id;
HasValue = hasValue;
DownloadFunc = downloadFunc;
}