Implement dictionary as interface C # [closed]

1

I'm trying to set a dictionary in my interface, but it's saying that the main class did not implement the dictionary.

Interface.cs

public interface IItem
{
    event Action<string, string, string, string, string, string, string, string, string, string, string> ItemToDataGrid;
    void Search();
    int SearchType { get; set; }
    Dictionary<string, string> SearchKey();
}

Principal.cs

public class Item : IItem
{
    public int _SearchType;
    public int SearchType
    {
        get
        {
            return this._SearchType;
        }
        set
        {
            this._SearchType = value;
        }
    }

    Dictionary<string, string> searchKey = new Dictionary<string, string>()
    {
        { "Item", "" },            
        { "Character", "" },
    };

Am I doing something wrong?

    
asked by anonymous 02.04.2017 / 22:08

1 answer

0

Your class Item has this:

oublic class Item : IItem
{
    public int _SearchType;
    public int SearchType
    {
        get
        {
            return this._SearchType;
        }
        set
        {
            this._SearchType = value;
        }
    }
    Dictionary<string, string> searchKey = new Dictionary<string, string>()
{
{ "Item", "" },
{ "Character", "" },
};
    public event Action<string, string, string, string, string, string, string, string, string, string, string> ItemToDataGrid;

    public void Search()
    {
        //TODO: Seu código aqui
    }

    public Dictionary<string, string> SearchKey()
    {
        //TODO: Seu código aqui

        return searchKey;
    }
}
    
03.04.2017 / 01:52