protected internal override int CompareToImpl(FieldDesc other, TypeSystemComparer comparer) { var otherField = (EcmaField)other; EcmaModule module = _type.EcmaModule; EcmaModule otherModule = otherField._type.EcmaModule; int result = module.MetadataReader.GetToken(_handle) - otherModule.MetadataReader.GetToken(otherField._handle); if (result != 0) { return(result); } return(module.CompareTo(otherModule)); }
protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer) { var otherMethod = (EcmaMethod)other; EcmaModule module = _type.EcmaModule; EcmaModule otherModule = otherMethod._type.EcmaModule; // Sort by module in preference to by token. This will place methods of the same type near each other // even when working with several modules int result = module.CompareTo(otherModule); if (result != 0) { return(result); } return(module.MetadataReader.GetToken(_handle) - otherModule.MetadataReader.GetToken(otherMethod._handle)); }