1

By default, a Class, an Interface and struct are internal in c#. Then why I am not able to access that same interface wherein I am passing it as a parameter to a constructor of a class within the same class file? The solution to mark interface as public is true but then whats the use of the by default nature of interface which is internal?

     // Did not mark as public
     interface IGetData
    {
        string ProvideData(int id);
    }

    public class EmpClientLogic
    {
        IGetData _getData;

        // Error on this line (if interface is not marked as public)
        public EmpClientLogic(IGetData getData)
        {
            _getData = getData;
        }
    }
  • Does this answer your question? [internal vs public in c#](https://stackoverflow.com/questions/4182015/internal-vs-public-in-c-sharp) – RamblinRose Jan 30 '20 at 12:20

0 Answers0