我用谷歌搜索但找不到正确答案。谁能知道如何处理这类错误?错误是:
public override ReadOnlyCollection<SecurityKey> SecurityKeys
{
get { throw new NotImplementedException(); }
}
Warning 20 CA1065 : Microsoft.Design : 'someToken.SecurityKeys.get()' creates an exception of type 'NotImplementedException', an exception type that should not be raised in a property. If this exception instance might be raised, use a different exception type, convert this property into a method, or change this property's logic so that it no longer raises an exception. D:\some\Security\someUserToken.cs
最佳答案
如果您抛出它是因为您还没有编写该属性,即您将其视为 Not(Yet)ImplementedException,那么您需要实现该属性。
但是,如果您向消费者表明此属性不合适,请改用 NotSupportedException。
关于c# - 警告 CA1065 Microsoft 设计未实现异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13815148/