Implementing custom exceptions in a Portable Class Library

后端 未结 1 1280
梦毁少年i
梦毁少年i 2021-02-12 20:40

When designing custom exceptions for .NET, MSDN provides these guidelines. In particular, the guidelines state that a custom exception:

  • should be serializable, i.e
相关标签:
1条回答
  • 2021-02-12 21:32

    Basically, ignore that guidance - that is for full .NET, and does not apply to portable class library projects. Indeed, if we look at (say) Silverlight (which includes WP7) we see:

    [ClassInterfaceAttribute(ClassInterfaceType.None)]
    [ComVisibleAttribute(true)]
    public class Exception
    

    Frankly, the main consumer of that requirement was remoting... and that is not in huge demand now.

    0 讨论(0)
提交回复
热议问题