in ILRepack/RepackImporter.cs [254:277]
private void CloneTo(FieldDefinition field, TypeDefinition nt)
{
if (nt.Fields.Any(x => x.Name == field.Name))
{
_logger.DuplicateIgnored("field", field);
return;
}
FieldDefinition nf = new FieldDefinition(field.Name, field.Attributes, Import(field.FieldType, nt));
nt.Fields.Add(nf);
if (field.HasConstant)
nf.Constant = field.Constant;
if (field.HasMarshalInfo)
nf.MarshalInfo = field.MarshalInfo;
if (field.InitialValue != null && field.InitialValue.Length > 0)
nf.InitialValue = field.InitialValue;
if (field.HasLayoutInfo)
nf.Offset = field.Offset;
CopyCustomAttributes(field.CustomAttributes, nf.CustomAttributes, nt);
}