Why is marking an assembly ComVisible(true) discouraged?

后端 未结 5 2053
日久生厌
日久生厌 2021-01-07 18:53

I have always marked my .NET assemblies as visible to COM with [assembly: ComVisible(true)], thinking that I never know when someone might need to call them fro

5条回答
  •  独厮守ぢ
    2021-01-07 19:44

    With the advent of Generics and other advanced types, it is more common now for methods to expose types that can't be COM visible than it is for them to expose types that can.

    The recommended method in CA1017 is intended to encourage you to expose only those types that you intend to be exposed to COM.

提交回复
热议问题