经过一番研究,我确定您可以应用于类的唯一访问修饰符是:
- public - 在任何程序集中可用
- internal - 仅在当前程序集中可用
但下面的错误消息似乎暗示,如果一个类未在命名空间中定义,则它可以定义为private、protected或protected internal。
public 和 internal 是您可以在类上使用的唯一类修饰符还是更多?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Test2343434
{
class Program
{
static void Main(string[] args)
{
Tools.ToolManager toolManager = new Tools.ToolManager();
Console.ReadLine();
}
}
}
namespace Tools
{
//error: Elements defined in a namespace cannot be explicitly
//declared as private, protected, or protected internal
private class ToolManager
{
public ToolManager()
{
Console.WriteLine("inside tool manager");
}
}
}