Reputation: 55
I've defined a simple interface:
public interface Categorizable {
string Category { get; set; }
}
Elsewhere, I try to use it in a function:
public void Add(Categorizable item)
{
string cat = item.Category;
}
However, Visual Studio tells me "Categorizable does not contain a definition for Category". How do I fix this so that Category can be used as an accessible property?
Upvotes: 1
Views: 858
Reputation: 81473
I
in front of them i. ICategorizable
, its very common and a standard for C#.Other than this, there isn't much else that can go wrong. This is how interfaces work (without deviation).
Upvotes: 2