简体   繁体   中英

Hide property from IntelliSense

How do I hide the Base64EncodedCertificate property from viewing in IntelliSense?

I tried those following attribute options and they don't work.

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; }
}

You didn't mark the question as ef related, but from the comment on the property in the source code -

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

if i get it right, you're using it only for queries / insert / update, and if this is the case you can hide the member using shadow properties or backing fields without public properties

Maybe you have ReSharper installed? Then try to look this option:

ReSharper 智能感知

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM