示例#1
0
        public static XElement ToXElement(this Dictionary <char, CharacterInfo> dict)
        {
            XElement result = new XElement(strCharacterInfoDict,
                                           from item in dict
                                           select KeyValuePairHelper.ToXElement(item));

            return(result);
        }
示例#2
0
        public static Dictionary <char, CharacterInfo> Parse(XElement xElement)
        {
            Dictionary <char, CharacterInfo> result = new Dictionary <char, CharacterInfo>();

            foreach (var item in xElement.Elements(KeyValuePairHelper.strKeyValuePair))
            {
                KeyValuePair <char, CharacterInfo> pair = KeyValuePairHelper.Parse(item);
                result.Add(pair.Key, pair.Value);
            }

            return(result);
        }