Added Examples\Program_CollectAccessHash

This commit is contained in:
Wizou 2021-10-11 16:11:37 +02:00
parent 4f9fbfc12c
commit 609e8a6a2d
2 changed files with 77 additions and 2 deletions

View file

@ -1220,10 +1220,10 @@ namespace WTelegram
=> _accessHashes.GetValueOrDefault(typeof(T));
/// <summary>Retrieve the access_hash associated with this id (for a TL class)</summary>
/// <typeparam name="T">a TL object class. For example User, Channel or Photo</typeparam>
public long? GetAccessHashFor<T>(long id) where T : ITLObject
public long GetAccessHashFor<T>(long id) where T : ITLObject
{
lock (_accessHashes)
return _accessHashes.GetOrCreate(typeof(T)).TryGetValue(id, out var access_hash) ? access_hash : null;
return _accessHashes.GetOrCreate(typeof(T)).TryGetValue(id, out var access_hash) ? access_hash : 0;
}
public void SetAccessHashFor<T>(long id, long access_hash) where T : ITLObject
{