예제 #1
0
 /// <summary>
 /// Add the specified object to the cache.
 /// </summary>
 /// <param name="key">cache key</param>
 /// <param name="relativeTo">Model for which the object is relative to</param>
 /// <param name="obj">The object to store.</param>
 private void AddToCache(string key, Model relativeTo, object obj)
 {
     if (obj != null)
     {
         CacheForModel cacheForModel = null;
         if (this.cache.ContainsKey(relativeTo))
         {
             cacheForModel = this.cache[relativeTo];
         }
         else
         {
             cacheForModel = new CacheForModel();
             this.cache.Add(relativeTo, cacheForModel);
         }
         cacheForModel.cache.Add(key, obj);
     }
 }
예제 #2
0
파일: Locater.cs 프로젝트: hol353/ApsimX
 /// <summary>
 /// Add the specified object to the cache.
 /// </summary>
 /// <param name="key">cache key</param>
 /// <param name="relativeTo">Model for which the object is relative to</param>
 /// <param name="obj">The object to store.</param>
 private void AddToCache(string key, Model relativeTo, object obj)
 {
     if (obj != null)
     {
         CacheForModel cacheForModel = null;
         if (this.cache.ContainsKey(relativeTo))
             cacheForModel = this.cache[relativeTo];
         else
         {
             cacheForModel = new CacheForModel();
             this.cache.Add(relativeTo, cacheForModel);
         }
         cacheForModel.cache.Add(key, obj);
     }
 }