[英]If I add a public method to a C# class, do I need to recompile other assemblies using that type?
Question in the title. 标题中的问题。
I'd like to avoid recompiling since the source code I'm modifying is third party and I'd like to use the original binaries where possible, and replace only the assembly which contains the class I modified. 我想避免重新编译,因为我正在修改的源代码是第三方,我想尽可能使用原始二进制文件,并只替换包含我修改过的类的程序集。 But I'm not sure if this is a safe thing to do. 但我不确定这是否安全。 In C++ for example this is definitely a bad idea. 以C ++为例,这绝对是一个坏主意。
No. 没有。
The assemblies that reference your library refer to methods and types using (some form of) name, so as long as you don't change the names of public types and methods (used by other assemblies), you don't need to recompile any of the assemblies - they will work with the updated version of the library. 引用库的程序集使用(某种形式的)名称引用方法和类型,因此只要不更改公共类型和方法的名称(由其他程序集使用),就不需要重新编译任何名称和方法。的程序集 - 它们将与库的更新版本一起使用。
In most cases Tomas answer is correct, but there are some cases where it is not true: 在大多数情况下,Tomas的答案是正确的,但有些情况并非如此:
不会。所有其他程序集将自动使用新更新的库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.