lundi 19 août 2019

C# custom attribute hoe to change target class propter

I'm try to find a solution to realize decrypt/encrypt when access a class property by get/set.

I had researched something about C# custom attribute, but seemimgly it can't work, so I want to know whether it's impossible to change the class property by attribute.

    [AttributeUsage(AttributeTargets.Property)]
    public class MyAttribute : Attribute
    {
        // How to change the tragetClass.Name when access by get/set
    }

    public class TargetClass
    {
        [MyAttribute]
        public string Name { get; set; }
    }





Aucun commentaire:

Enregistrer un commentaire