Inconsistent accessibility: property type is less accessible

后端 未结 3 1228
没有蜡笔的小新
没有蜡笔的小新 2020-12-14 05:34

Please can someone help with the following error:

Inconsistent accessibility: property type \'Test.Delivery\' is less accessible than property \'Test.

3条回答
  •  庸人自扰
    2020-12-14 05:42

    make your class public access modifier,

    just add public keyword infront of your class name

     namespace Test
    {
      public  class Delivery
        {
            private string name;
            private string address;
            private DateTime arrivalTime;
    
            public string Name
            {
                get { return name; }
                set { name = value; }
            }
    
            public string Address
            {
                get { return address; }
                set { address = value; }
            }
    
            public DateTime ArrivlaTime
            {
                get { return arrivalTime; }
                set { arrivalTime = value; }
            }
    
            public string ToString()
            {
                { return name + address + arrivalTime.ToString(); }
            }
        }
    }
    

提交回复
热议问题