예제 #1
0
        public string this[string key]
        {
            get
            {
                var entry = list.FirstOrDefault(e => e.Key.Equals(key));

                if (entry == null)
                    return null;

                return entry.Value;
            }
            set
            {
                var entry = list.FirstOrDefault(p => p.Key.Equals(key));

                if (entry == null)
                {
                    entry = new MetadataEntry();
                    entry.Key = key;
                    list.Add(entry);
                }

                entry.Value = value;

                if (string.IsNullOrEmpty(entry.Value))
                    list.Remove(entry);
            }
        }