我有一个BaseClass
,它由一个程序集中大约20+个类继承。此基类的属性由其他一些程序集(朋友程序集)使用。我已声明属性为internal
,以便其他组件无法看到或使用它们。从dll中隐藏一个基类
现在,有没有办法将隐藏BaseClass
本身从其他组件除了朋友大会?也许有更好的机制或设计构想?
我不能使BaseClass
internal
,因为继承它的类是public
。
这就是BaseClass
目前的样子。
[assembly: InternalsVisibleTo("MyApp.FriendAssembly1")]
[assembly: InternalsVisibleTo("MyApp.FriendAssembly2")]
namespace MyApp.Input
{
/// <summary>
/// Note: The members of this class are visible only to certain friend assemblies. The normal consumers of this assembly can simply ignore this class.
/// </summary>
public class BaseClass
{
internal bool Property1 { get; set; }
internal bool Property2 { get; set; }
}
}
这是不可能的。期。 – niksofteng