我在两个解决方案中都使用了一个项目IBSampleApp,并且它们的类在这两个类中均遇到以下编译器错误。
I have one project IBSampleApp used in two solutions and it’s classes suffer the following compiler error in both.
由于受到保护而无法访问级别
inaccessible due to it’s protection level
执行解决方案中IB执行项目的IBClient.cs错误:
Error in IBClient.cs of IB Execution project in Execution solution:
IBSampleApp项目中的TickPriceMessage类:
TickPriceMessage class in IBSampleApp project:
已将InternalsVisibleTo属性添加到IBSampleApp项目的AssemblyInfo.cs中(由@JamesFaix推荐):
Added InternalsVisibleTo property to AssemblyInfo.cs of IBSampleApp project (recommended by @JamesFaix):
问题仍然存在。如何使TickPriceMessage类可用于两个解决方案?
The problem persistes still. How to make TickPriceMessage class available to both solutions?
推荐答案您在内部类上有一个公共构造函数。在缺少任何访问修饰符的情况下,c#默认为对类型的限制最大,对于像您这样的课程,它是内部的 。
You have a public constructor on an internal class. With lack of any access modifier, c# defaults to the most restricted for the type which is internal for a class like yours.
// this is an "internal" class class TickPriceMessage { ... }更多推荐
由于其保护级别,无法访问该类
发布评论