【问题标题】:property inaccessible due to protection level?由于保护级别而无法访问的财产?
【发布时间】:2013-03-24 00:54:17
【问题描述】:

这是显示错误的行:

public IOAuth2ServiceProvider<IElance> ElanceServiceProvider { get; set; }

它在该行的IElance 类型上显示错误,但这是界面:

public interface IElance : IApiBinding
    {
        /// <summary>
        /// Search all jobs, list jobs associated with an employee or a freelancer, and retrieve information for a specific job.
        /// </summary>
        IJobOperations JobOperations { get; }

        /// <summary>
        /// Access all messages, users, messages, and Work View™ data associated with an Elance Workroom.
        /// </summary>
        IWorkRoomOperations WorkroomOperations { get; }

        /// <summary>
        /// View all of the information associated with an employee or a freelancer.
        /// </summary>
        IProfileOperations ProfileOperations { get; }

        /// <summary>
        /// View detailed information on freelancers, and retrieve a list of all freelancers employed by an employer.
        /// </summary>
        IFreelancerOperations FreelancerOperations { get; }

        /// <summary>
        /// List Elance groups, and retrieve lists of members and jobs belonging to a group.
        /// </summary>
        IGroupOperations GroupOperations { get; }

        /// <summary>
        /// Obtain ancillary Elance information, such as the current list of all job categories.
        /// </summary>
        IUtilityOperations UtilityOperations { get; }
    }

我一辈子都想不通它为什么告诉我这个。我错过了一些明显的东西吗?我将非常感谢有关此错误的任何指导。

【问题讨论】:

  • IpiBinding 的可访问状态是?
  • 更新界面主体
  • 更新了界面主体
  • 如果你只声明一个'IElance'类型的公共成员变量,你会得到同样的错误吗?即公共 IElance temp;
  • 完整的错误是什么?

标签: c#


【解决方案1】:

这可能是由IApiBinding 或其基本接口之一不是public 引起的。另一种可能性是接口成员使用的类型之一不是公共的。

【讨论】:

  • 我怎样才能知道呢?它在一个外部库中
  • 在这种情况下,它更有可能是接口成员的类型之一。都是公开的吗?
  • 它不允许我在界面中使用public 修饰符
  • 我说的不是接口成员,而是成员的类型。接口IJobOperationsIWorkRoomOperations 等是否已公开?
  • 这发生在我身上,因为我将我的接口标记为类而不是接口。我太傻了。
最近更新 更多