I have a custom attribute class defined as follows.
[AttributeUsage(AttributeTargets.Property, Inherited = false)]
internal class EncryptedAttribute : System.Attribute
{
private bool _encrypted;
public EncryptedAttribute(bool encrypted)
{
_encrypted = encrypted;
}
public virtual bool Encrypted
{
get
{
return _encrypted;
}
}
}
I applied the above attribute to another class as follows.
public class KeyVaultConfiguration
{
[Encrypted(true)]
public string AuthClientId { get; set; } = "";
public string AuthClientCertThumbprint { get; set; } = "";
}
How do I get the value of Encrypted=True on property AuthClientId?
var config = new KeyVaultConfiguration();
// var authClientIdIsEncrypted = ??
In .NET Framework, this was easy. In .NET CORE, I think this is possible but I don't see any documentation. I believe you need to use System.Reflection but exactly how?