C#C
C#15mo ago
aa55h

Mono.Cecil TypeReference modifies TypeDefinition

i have this code:
MemberReference member = instruction.Operand; 
if (Mappings.GetType(member.DeclaringType.Name, DefaultNamespace) is TypeDefinitionEntry typeDefinition)
{
    WriteIfVerbose($"Remapping reference to {member.Name}'s type {member.DeclaringType.Name} -> {typeDefinition[TargetNamespace]}");
    member.DeclaringType.Name = typeDefinition.Names[TargetNamespace];
}

the problem is the second line in the if statement body, it seems like it also modifies the class the member belongs to, and not only the reference to it, any idea why?
Was this page helpful?