从IntelliSense隐藏属性

时间:2017-10-23 20:03:23

标签: c# visual-studio visual-studio-code

如何在IntelliSense中隐藏Base64EncodedCertificate属性?

我尝试了以下属性选项但它们无法正常工作。

public class ThirdParty
{
    private string _Base64EncodedCertificate = null;

    public Guid ThirdPartyId { get; set; }
    // Notice: Allowed in source code use but not allowed in EFCore (EFCore doesn't support this).
    [NotMapped]
    public X509Certificate2 Certificate
    {
        get { return (_Base64EncodedCertificate == null ? null : new X509Certificate2(Convert.FromBase64String(_Base64EncodedCertificate))); }
        set { _Base64EncodedCertificate = (value == null ? null : Convert.ToBase64String(value.GetRawCertData())); }
    }
    // Notice: Not allowed in Source code but is used by EFCore (EFCore limitation workaround).
    [Browsable(false)]
    [Bindable(false)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    [EditorBrowsable(EditorBrowsableState.Never)]
    public string Base64EncodedCertificate
    {
        get { return _Base64EncodedCertificate; }
        private set { }
    }
    public string RawData { get; set; }
    public DateTime CreatedDate { get; set; }
}

2 个答案:

答案 0 :(得分:1)

您没有将该问题标记为相关,而是来自源代码中对该属性的评论 -

// Notice:Not allowed in Source code but is used by EFCore (EFCore limitation workaround).

如果我做对了,您只能将其用于查询/插入/更新,如果是这种情况,您可以使用shadow propertiesbacking fields without public properties隐藏该成员

答案 1 :(得分:0)

也许你安装了ReSharper?然后尝试查看此选项:

ReSharper InteliSense