private static IDictionary <FieldReference, FieldDefinition> AddFields(TypeDefinition type, IEnumerable <IFieldRef> fields) { Dictionary <FieldReference, FieldDefinition> fieldMap = new Dictionary <FieldReference, FieldDefinition>(); foreach (IFieldRef field in fields) { CecilFieldRef cecilFieldRef = (CecilFieldRef)field; FieldDefinition fieldDefinition = CloneField((FieldDefinition)cecilFieldRef.Reference); fieldMap.Add(cecilFieldRef.Reference, fieldDefinition); type.Fields.Add(fieldDefinition); } return(fieldMap); }
public override void Visit(FieldValue operand) { CecilFieldRef cecilFieldRef = (CecilFieldRef)operand.Field; cecilFieldRef.Reference = _fields[Resolve(operand.Field)]; }