相关疑难解决方法(0)

隐藏名称空间只包含类库中的内部类型?

我有一个类库,有几个名称空间只包含内部类型.

但是,在应用程序项目中使用类库时,名称空间显示在intellisense中,但当然它们是空的.在其他项目中使用intellisense时,有什么方法可以完全隐藏命名空间吗?

我也试图应用于EditorBrowsableAttribute所有内部类,但我想做的是将其应用于命名空间,这当然是不可能的.

或者,如果我足够关心这个,我必须将类型移动到包含公共类型的命名空间中的唯一选择?

c# intellisense namespaces internal hide

47
推荐指数
2
解决办法
1万
查看次数

扩展MVC RequiredAttribute

我有一个ExtendedAttribute的扩展类,它不会发回错误消息.如果我在调试器中检查它,文本就没问题了.

public class VierRequired : RequiredAttribute
{
    public VierRequired(string controlName)
    {
        //...
    }

    public string VierErrorMessage
    {
        get { return ErrorMessage; }
        set { ErrorMessage = value; }
    }

    // validate true if there is any data at all in the object
    public override bool IsValid(object value)
    {
        if (value != null && !string.IsNullOrEmpty(value.ToString()))
            return true;

        return false; // base.IsValid(value);
    }
}
Run Code Online (Sandbox Code Playgroud)

我这样称呼它

[VierRequired("FirstName", VierErrorMessage = "Please enter your first name")]
public string FirstName { get; set; }
Run Code Online (Sandbox Code Playgroud)

和mvc-view

<%: …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc data-annotations asp.net-mvc-2

8
推荐指数
1
解决办法
5319
查看次数