问题描述
我在两个解决方案中都使用了一个项目IBSampleApp,并且它们的类在这两个类中均遇到以下编译器错误。
I have one project IBSampleApp used in two solutions and it’s classes suffer the following compiler error in both.
执行解决方案中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 { ... }
这篇关于由于其保护级别,无法访问该类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!