Пример #1
0
        public void PublicGenericGetReferenceType()
        {
            var getter = (typeof(PublicGenericClass <string>).Reflection().GetDescriptor("publicField") as IValueMemberDescriptor).ToCompiledGetValue();

            var instance = new PublicGenericClass <string>();

            instance.publicField = "test";

            Assert.Equal("test", getter(instance));
        }
Пример #2
0
        public void PublicGenericGetValueType()
        {
            var getter = (typeof(PublicGenericClass <int>).Reflection().GetDescriptor("publicField") as IValueMemberDescriptor).ToCompiledGetValue();

            var instance = new PublicGenericClass <int>();

            instance.publicField = 42;

            Assert.Equal(42, getter(instance));
        }