using System.Collections.Generic;
public sealed class DataProvider : IDisposable
public extern int LongRunningCalculation(int value, int value2);
public extern void Dispose();
private readonly object _sync = new object();
private static Dictionary<int[], object> _ht;
public int GetValue(int index, int index2)
var key = new[] {index, index2};
if (_ht.ContainsKey(key) & _ht[key].GetType() == typeof(int))
public static void Create()
DataProvider provider = new DataProvider();
for (int i = 0; i < 100; i++)
for (int j = 1; j <= 12; i++)
_ht[new [] { i, j }] = provider.LongRunningCalculation(i, j);