I hereby claim:
- I am guhou on github.
- I am guhou (https://keybase.io/guhou) on keybase.
- I have a public key ASAB4PEZkQNTnWrGIXvORFF0CcI_c3QzWA1yk8l8Dr9pOAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| export function sequence<T>( | |
| map: Map<string, Promise<T>> | |
| ): Promise<Map<string, T>> { | |
| return Promise.all( | |
| Array.from(map, ([key, promisedValue]) => | |
| promisedValue.then<[string, T]>(value => [key, value]) | |
| ) | |
| ).then((entries) => new Map(entries)); | |
| } |
| ### Keybase proof | |
| I hereby claim: | |
| * I am guhou on github. | |
| * I am guhou (https://keybase.io/guhou) on keybase. | |
| * I have a public key ASAZNEe0DRKu9xFDlHFgr6TGZPyE9zmMdBt86gMWZixpUQo | |
| To claim this, I am signing this object: |
In this article I present an introduction to generic List types in the C# language. I assume an audience familiar with the principles of structured programming, including parameters, arrays and procedures, but with little experience with object-oriented programming. I will motivate an example for an encapsulated collection class, and then introduce generics as a means to improve our collection.
| using System; | |
| using System.Collections.Generic; | |
| public class Cache<K, V> where V : class | |
| { | |
| private readonly Dictionary<K, WeakReference<V>> _data; | |
| public Cache() | |
| { | |
| _data = new Dictionary<K, WeakReference<V>>(); |