using System; using System.Reflection; namespace attributeTest { [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct)] public class AuthorAttribute : System.Attribute { public string name { get; set; } public double verson { get; set; } public AuthorAttribute(string nm, double vr) { this.name = nm; this.verson = vr; } } [Author("xiaozhang", 2.0)] public class A { private double a; public B b { get; set; } public double getdoubleina() { return a; } public A(double a) { this.a = a; b = new B("xiaozhang"); } } publi
C# 反射获得字段 和 修改字段的方法
最新推荐文章于 2024-05-22 14:35:18 发布