interface - I can't access my inherited values in c# -


i have interface looks this:

public interface iselectspace {     bool showspaceselection { get; set; }     ienumerable<space> availablespaces { get; set; } } 

i have interface looks this:

public interface iselectsinglespace : iselectspace {     string space { get; set; }     string spacename { get; set; } } 

however, when try , access list of ienumerables of variable availablespaces, can't use count function this:

public static class selectsinglespace {     public static void dostuff(this iselectsinglespace selectsinglespace)     {         console.write(selectsinglespace.availablespaces.count());     } } 

am not referencing variable correctly?

i initialize method in class:

var selectsinglespace = iselectsinglespace; selectsinglespace.dostuff(); 

try this: (i had trouble acessing extension methods using this keyword in derived classes, maybe it's that. in code below, try trick around)

public static class selectsinglespace {     public static void dostuff(this iselectsinglespace selectsinglespace)     {         ienumerable<space> availablespaces = selectsinglespace.availablespaces;         console.write(availablespaces.count());     } } 

Comments