none
is inaccessible due to its protection level

    Question

  • I get this error: "BusinessDataLayer.SSFEntry is inaccessible due to its protection level", where BusinessDataLayer is the namespace that I've created in a Class Library as a separate project and SSFEntry is the name of the class within it. So I'm trying to access this "SSFEntry" class in my .aspx.cs page that resides in a separate project. I've referenced the .dll(BusinessDataLayer) and have declared the class, 'SSFEntry' to be Public. So what causes the problem?

    The below code is from the Namespace:-

    public class SSFEntry
        {  #region Declare

            object

              ORetVal....

           #endregion

         }

    The below code is from .aspx.cs file:-

        BusinessDataLayer.SSFEntry obj = new BusinessDataLayer.SSFEntry();

    and this the part(Bold and Italicized) where I get the error.


    arun.987

    Tuesday, August 07, 2012 2:08 PM

Answers

All replies

  • namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                SSFEntry obj = new SSFEntry();
                obj.Name = "Hello";
            }
        }
        public class SSFEntry
        {
            private string prvName;
    
            public string Name
            {
                get { return prvName; }
                set { prvName = value; }
            }
        }
    }



    Web Developer


    • Edited by Norkk Tuesday, August 07, 2012 2:14 PM
    Tuesday, August 07, 2012 2:13 PM
  • How did you referenced the BusinessDataLayer?

    ---

    How?

    You should add reference from Project1 to Project2 to be able to write using namespace MainProject.Project2; 
    To add reference, from Project1 solution explorer references->add reference->browse to locate the project2 
    assembly or projects tab to get all assembles in all solution including project2 assembly.


    Mitja

    Tuesday, August 07, 2012 2:14 PM
  • Is it possible that with your referenced class library ....dll is something wrong. You should try to rebuild the dll file. Perhaps you get at least some meaningful error messages.

    Regards,

    wizend

    Wednesday, August 08, 2012 1:02 PM
  • You don't have a BusinessDataLayer class as well as a BusinessDataLayer namespace by any chance?
    Wednesday, August 08, 2012 11:52 PM
  • @ Mitja Bonca

    I had referenced it unless by which I'll not be able to get 'BusinessDataLayer.SSFEntry' through Intelli-sense.



    • Edited by Arun987 Friday, August 10, 2012 8:01 AM
    Thursday, August 09, 2012 5:53 PM