示例#1
0
        /// <summary>
        /// Converts the dictionary into a list of key-value pair lists.
        /// </summary>
        /// <param name="dict">A dictionary object</param>
        /// <returns name="Keys+Values">Returns a list of key-value pair lists.</returns>
        public static c.List<c.List<System.Object>> GetKeyValuePairs (Dictionary dict)
        {
            c.List< c.List <System.Object> > l = new c.List< c.List <System.Object> >();
            c.List<string> k = new c.List<string>();
            c.List<System.Object> v = new c.List<System.Object>();

            foreach (c.KeyValuePair<string, System.Object> kvp in dict.internalDictionary)
            {
                l.Add(new c.List<System.Object>{kvp.Key, kvp.Value} );
            }
            return l;
        }
示例#2
0
        /// <summary>
        /// Retrieves the values in the dictionary as a list.
        /// </summary>
        /// <param name="dict">A dictionary object.</param>
        /// <returns name="values">A list of values.</returns>
        public static c.List<System.Object> GetValues(Dictionary dict)
        {
            c.ICollection<System.Object> values = dict.internalDictionary.Values;

            c.List<System.Object> v = new c.List<System.Object>();

            foreach (System.Object value in values)
            {
                v.Add(value);
            }
            return v;
        }