c# 4.0 - Hide interface method in C# -



c# 4.0 - Hide interface method in C# -

i have such hierarchy:

public interface imodule { void method1(); void method2(); } public interface ipublic { imodule module { get; } }

in stuff (feature toggle) need hide method2() time public interface , create internal. used in tests, hidden in release. possible implement such thing?

you implement probably:

public interface imodule { void method1(); } public interface imodule2 : imodule { void method2(); } public interface ipublic { imodule module { get; } }

then create actual implementation of ipublic homecoming imodule2 implementation rather imodule in feature toggle code cast imodule imodule2. need check in method2 implementation toggle enabled.

this doesn't remove public interface, makes not discoverable. can't remove though there feature can toggled.

not great, consequence of feature toggle requirements think.

c#-4.0 design

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -