Сategory 和提示不起作用

Сategory and hints are not working

我的应用程序中有一个 属性 网格,我为其创建了以下 class:

class NginXConfig
{
    [Browsable(true)]
    [ReadOnly(true)]
    [Category("General")]
    [Description("Defines the number of worker processes. Windows only supports one.")]
    int _worker_processes = 1;
    public int worker_processes
    {
        get { return _worker_processes; }
        set { _worker_processes = value; }
    }

    [Browsable(true)]
    [ReadOnly(false)]
    [Category("General")]
    [Description("Changes the limit on the maximum number of open files (RLIMIT_NOFILE) for worker processes.")]
    int _worker_rlimit_nofile = 100000;
    public int worker_rlimit_nofile
    {
        get { return _worker_rlimit_nofile; }
        set { _worker_rlimit_nofile = value; }
    }

    [Browsable(true)]
    [ReadOnly(false)]
    [Category("General")]
    [Description("Defines the error logging level. Availble options: debug | info | notice | warn | error | crit | alert | emerg")]
    string _error_log_level = "crit";
    public string error_log_level
    {
        get { return _error_log_level; }
        set { _error_log_level = value; }
    }
}

在 属性 网格上,当我设置 SelectedObject - 它呈现如下:

  1. 我定义为“常规”的类别没有显示。它显示为“杂项”。

  2. 提示 Description 未显示。

  3. 是否可以通过 class 定义这些字段在我的 属性 网格上的显示顺序?

编辑

此问题现已解决。这是我的 class:

的工作版本
class NginXConfig
{
    [Browsable(true), ReadOnly(true), Category("General"), DefaultValueAttribute(1), Description("Defines the number of worker processes. Windows operating system supports only one.")]
    public int worker_processes { get ; set; }

    [Browsable(true), ReadOnly(false), Category("General"), DefaultValueAttribute(10000), Description("Changes the limit on the maximum number of open files (RLIMIT_NOFILE) for worker processes.")]
    public int worker_rlimit_nofile { get; set; }

    [Browsable(true), ReadOnly(false), Category("General"), DefaultValueAttribute("crit"), Description("Defines the error logging level. Availble options: debug | info | notice | warn | error | crit | alert | emerg")]
    public string error_log_level { get; set; }

    public NginXConfig()
    {
        worker_processes = 1;
        worker_rlimit_nofile = 10000;
        error_log_level = "crit";
    }
}

这样定义:

int _worker_processes = 1;

[Browsable(true),ReadOnly(true),Category("General"),Description("Defines the number of worker processes. Windows only supports one.")]
public int worker_processes
{
    get { return _worker_processes; }
    set { _worker_processes = value; }
}

属性用于属性,不用于私有变量。为什么不 { get; set; } 没有 int _worker_processes = 1;.