CS0436: Type conflicts with the imported type

后端 未结 5 2002
礼貌的吻别
礼貌的吻别 2020-12-06 09:43

I am including an instance of the same source files in multiple assemblies using the Add As Link option. I specifically need to include an instance of the same source withi

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-06 09:59

    The only time conflicts occur is when two dependent classes include the same class. There are two workarounds:

    1. Disable the warning in classes that cause CS0436:

      #pragma warning disable 0436
      
    2. Have a separate instance of the class, uniquely named in each client project (undesirable from a maintenance point of view).

    EDIT: There is also a solution: do what Mark suggests below, and mark duplicate classes internal.

提交回复
热议问题