c# - How to prevent expose any other interface methods? -



c# - How to prevent expose any other interface methods? -

i have 1 interface below

public interface i1 { public int add(int , int b); public int subtract (int a, int b); } public class myclass : i1 { //here can access both methods of interface i1 //add , subtract want expose add together not subtract method //how can accomplish this? }

how can expose particular method , prevent other.

you hide method explicit implementation. i'd bad thought , should split interface in 2 instead, possible

public class myclass { public int i1.subtract(int a, int b) { throw new notimplementedexception(); } }

when done subtract visible when object cast i1

c# asp.net .net interface

Comments

Popular posts from this blog

javascript - mongodb won't find my schema method in nested container -

r - url in CRAN extension manual -

asp.net - .NET Control.ID property inconsistency -