I have a class below, i have extracted all the properties to a Interface but i don't seem to be able to extract it... Obviously create a new object like
ITestItem item = new TestItem(); doesn't give me access to Properties which is an instance of Meta class.
I also wanted to stop anyone from create an instance of Meta class outside of TestItem... i tried marking it as internal but that would allow me because Properties is public.
Also i am unsure whether i need to have an interface for META??
here is my class... can anyone help?
public class TestItem : ITestItem { public bool Enabled { get; set; } public Meta Properties = new Meta(); public List<int> Items { get; set; } public class Meta { internal Meta { } public string Name { get; set; } } public TestItem() { this.Items = new List<int>(); } } EDIT I have uppdated the class above to include an internal constructor for Meta so it can't be instanciated outside the class.
Here is my interface i have (as suggested by giddy)... It says now that it doesn't implement Properties
public interface ITestItem { bool Enabled { get; set; } Meta Properties { get; set; }; List<int> Items { get; set; } }