예제 #1
0
        /// <summary>
        /// Gets all auxiliary data of the specified type as a dictionary keyed by symbol
        /// </summary>
        /// <typeparam name="T">The type of auxiliary data</typeparam>
        /// <returns>A dictionary containing all auxiliary data of the specified type</returns>
        public DataDictionary <T> GetAux <T>()
        {
            Dictionary <Symbol, List <BaseData> > d;

            if (!_auxiliaryData.TryGetValue(typeof(T), out d))
            {
                return(new DataDictionary <T>());
            }
            var dictionary = new DataDictionary <T>();

            foreach (var kvp in d)
            {
                var item = kvp.Value.OfType <T>().LastOrDefault();
                if (item != null)
                {
                    dictionary.Add(kvp.Key, item);
                }
            }
            return(dictionary);
        }
예제 #2
0
 /// <summary>
 /// Provides a convenience method for adding a base data instance to our data dictionary
 /// </summary>
 public static void Add <T>(this DataDictionary <T> dictionary, T data)
     where T : BaseData
 {
     dictionary.Add(data.Symbol, data);
 }