Home > Database > Mysql Tutorial > body text

Inconsistent accessibility Error

WBOY
Release: 2016-06-07 15:38:02
Original
1209 people have browsed it

今天给Outlook做了一个根据邮件的Subjects移动邮件到指定文件夹的小东西。 刚开始使用C#,对于很多东西也是现用现学,再写自己的Outlook类的时候直接使用了VS自动生成的一些代码(类声明),结果编译的时候除了问题: Error1Inconsistent accessibility: pro

今天给Outlook做了一个根据邮件的Subjects移动邮件到指定文件夹的小东西。

刚开始使用C#,对于很多东西也是现用现学,再写自己的Outlook类的时候直接使用了VS自动生成的一些代码(类声明),结果编译的时候除了问题:

 

 

 

Error 1 Inconsistent accessibility: property type 'MoveMailBasedOnName.Outlook' is less accessible than property 'MoveMailBasedOnName.SettingForm.MyOutlook' 

 

这里面Outlook 类没有修改访问级别,使用的事默认访问。而在SettingForm中用于要在MainForm中访问SettingForm中的myOutlook属性,就设置了

 

privrate Outlook myOutlook = null;

 

public Outlook MyOutllok

{

    get{ return myOutlook; }

}

 

这也就是导致编译出错的罪魁祸首,因为Outlook类的默认访问级别为protect,所以低于设置get property时的public。所以出错。

所以修改方法也很简单,只需要将Outlook类的访问级别设置为public就可以了。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!