Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

How can i make the Dictionary Parameter nullable

$
0
0

i have a code like this

public static Dictionary<int, List<Monitor>> AddItemsFromDatabaseToCacheObject(Dictionary<int, List<Monitor>> valueListsByKey, DateTime lastInsertedTimeStamp)
        {
            var newItemsList = new SqlMonitorProvider().GetAllMonitorItems(lastInsertedTimeStamp);

            if (newItemsList.Count > 0)
            {
                foreach (var item in newItemsList)
                {
                    List<Monitor> valueList = new List<Monitor>();

                    if (valueListsByKey.ContainsKey(item.performanceCounterId))
                    {
                        valueListsByKey[item.performanceCounterId].Add(item);
                    }
                    else
                        valueList.Add(item);

                    valueListsByKey.Add(item.performanceCounterId, valueList);
                }
            }

            return valueListsByKey;
        }

i want to make the Dictionary valueListsByKey argument nullable. I was thinking of overloading this method but is there any way to make it nullable so that i can pass a null to it?


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>