Exception for missing data

后端 未结 7 918
难免孤独
难免孤独 2021-02-04 23:12

I was wondering what kind of exception should one throw for missing data. For example if an xml node doesn\'t contain data. It would be easy to \"throw new Exception(...

7条回答
  •  情书的邮戳
    2021-02-04 23:59

    There is also System.Data.ObjectNotFoundException class which you may consider.

    Update: As of Entity Framework 6, this exception class' fully qualified name is System.Data.Entity.Core.ObjectNotFoundException.

    See this question for further details on EF5->EF6 namespace changes.

提交回复
热议问题