Skip to content

signature of the body and declaration in a method implementation do not match #78

@wickedmachinator

Description

@wickedmachinator

I am getting the following exception when I start the resulting exe file, even if there is no protection enabled.

"signature of the body and declaration in a method implementation do not match"

code:

    public class EasyDict<TKey, TValue> : IEnumerable<KeyValuePair<TKey, TValue>>
    {
        private readonly Dictionary<TKey, TValue> _dict;

        public EasyDict()
        {
            _dict = new Dictionary<TKey, TValue>();
        }

        public EasyDict(int capacity)
        {
            _dict = new Dictionary<TKey, TValue>(capacity);
        }

        public int Count => _dict.Count;

        public IEnumerable<TValue> Values => _dict.Values;

        public TValue this[TKey key]
        {
            get
            {
                _dict.TryGetValue(key, out var value);
                return value;
            }
            set
            {
                _dict[key] = value;
            }
        }

        public void Add(TKey key, TValue value)
        {
            _dict[key] = value;
        }

        public void Clear()
        {
            _dict.Clear();
        }

        public bool ContainsKey(TKey key)
        {
            return _dict.ContainsKey(key);
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return _dict.GetEnumerator();
        }

        IEnumerator<KeyValuePair<TKey, TValue>> IEnumerable<KeyValuePair<TKey, TValue>>.GetEnumerator()
        {
            return _dict.GetEnumerator();
        }

        public bool Remove(TKey key)
        {
            return _dict.Remove(key);
        }

        public bool TryGetValue(TKey key, out TValue value)
        {
            return _dict.TryGetValue(key, out value);
        }
    }

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions