Пример #1
0
        public void GetValueGenericStruct()
        {
            var source = new StructLevel {
                Name = "meh"
            };
            var getter = (Getter <StructLevel, string>)Getter.GetOrCreate(typeof(StructLevel).GetProperty("Name"));

            Assert.AreEqual("meh", getter.GetValue(source));
        }
Пример #2
0
        public void GetValueGenericStruct()
        {
            var source = new StructLevel {
                Name = "meh"
            };
            var getter = (Getter <StructLevel, string>)Getter.GetOrCreate(typeof(StructLevel).GetProperty(nameof(StructLevel.Name), BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly));

            Assert.AreEqual("meh", getter.GetValue(source));
        }