Today, I encountered a problem because the cat did not notice the access permission at the beginning.
Cats and cats use English version. vs. The English version of cats is not good. At the beginning, I still felt that the error message was not clear.
The error was found only after several failed attempts.
In this case, I directly added an object to the presentation layer to facilitate data transmission. I directly added a CS file and then wrote the object.
The problem arises.
The class in the CS file added by vs is internal by default.
Generally, the cat and the cat remember to change it to public. But today, because it is called at the same layer, I forgot to change it to public.
I wrote it as an attribute on a form and created this form in the form and passed the value to this property.
If the type of the attribute does not match the data transfer type, an error will be prompted. The error is not prompted because the attribute is matched, but an error is prompted at the place where the attribute is defined.
I didn't understand it at the beginning, so I couldn't figure it out. The attribute type is correct. How can I prompt an error?
The prompt is:
Error 1
Inconsistent accessibility: property type 'System. Collections. Generic. List <qzwbookstore. orderbook> 'is less accessible than property' qzwbookstore. commitorder. orderbooks'
E:/Course Design/qzw-Hf-bookstoretest/qzwbookstore/commitorder. CS
17 32
Qzwbookstore
At that time, I thought I could access accessible ??
The defined code is
Public list <orderbook> orderbooks {Get; set ;}
I have no idea whether public is accessible. Why ??
I have taken a closer look.
Then go to orderbook. CS
After half a day
In front of the mijia public ....
Because the access permission of this attribute is higher than the access permission defined by it!
I have encountered many access permissions before.
However, this seems to work, and it seems to be a very easy place to neglect.
I felt like I was hit by me in a strange and strange way.