예제 #1
0
        public void PersistentFieldSignature()
        {
            var module = ModuleDefinition.FromFile(typeof(SingleField).Assembly.Location);
            var field  = (FieldDefinition)module.LookupMember(
                typeof(SingleField).GetField(nameof(SingleField.IntField)).MetadataToken);

            field.Signature = FieldSignature.CreateInstance(module.CorLibTypeFactory.Byte);

            var newField = RebuildAndLookup(field);

            Assert.True(newField.Signature.FieldType.IsTypeOf("System", "Byte"), "Field type should be System.Byte");
        }