Mercurial > hg > Database > Christie-sharp
view Test/RewritingTest/AttributeCheck.cs @ 28:84e0b85af821
update CodeGearManager
author | riono <e165729@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 20 Jan 2021 02:21:55 +0900 |
parents | |
children | 0cd2684e401b |
line wrap: on
line source
using System; using System.Reflection; using Christie_net.annotation; namespace Christie_net { public class AttributeCheck { [Take] private int num = 0; [Peek] public string name = "riono"; [PeekFrom("meme")] protected string nextName = "local"; public AttributeCheck() { nextName = "dsaql"; } private static void Main(string[] args) { AttributeCheck attributeCheck = new AttributeCheck(); foreach (var field in attributeCheck.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly | BindingFlags.Instance)) { foreach (var attribute in field.GetCustomAttributes(false)) { Console.WriteLine(attribute); if (attribute.GetType() == typeof(PeekFrom)) { PeekFrom peekFrom = (PeekFrom) attribute; Console.WriteLine("val " + field.GetValue(attributeCheck) ); } } } } } }