System.NotImplementedException class
This article provides supplementary remarks to the reference documentation for this API.
The NotImplementedException exception is thrown when a particular method, get accessor, or set accessor is present as a member of a type but is not implemented.
NotImplementedException uses the default Object.Equals implementation, which supports reference equality. For a list of initial values for an instance of NotImplementedException, see the NotImplementedException constructors.
Throw the exception
You might choose to throw a NotImplementedException exception in properties or methods in your own types when the that member is still in development and will only later be implemented in production code. In other words, a NotImplementedException exception should be synonymous with "still in development."
Handle the exception
The NotImplementedException exception indicates that the method or property that you are attempting to invoke has no implementation and therefore provides no functionality. As a result, you should not handle this error in a try/catch
block. Instead, you should remove the member invocation from your code. You can include a call to the member when it is implemented in the production version of a library.
In some cases, a NotImplementedException exception may not be used to indicate functionality that is still in development in a pre-production library. However, this still indicates that the functionality is unavailable, and you should remove the member invocation from your code.
NotImplementedException and other exception types
.NET also includes two other exception types, NotSupportedException and PlatformNotSupportedException, that indicate that no implementation exists for a particular member of a type. You should throw one of these instead of a NotImplementedException exception under the following conditions:
Throw a PlatformNotSupportedException exception on platforms on which the functionality is not supported if you've designed a type with one or more members that are available on some platforms or versions but not others.
Throw a NotSupportedException exception if the implementation of an interface member or an override to an abstract base class method is not possible.
For example, the Convert.ToInt32(DateTime) method throws a NotSupportedException exception because no meaningful conversion between a date and time and a 32-bit signed integer exists. The method must be present in this case because the Convert class implements the IConvertible interface.
You should also throw a NotSupportedException exception if you've implemented an abstract base class and add a new member to it that must be overridden by derived classes. In that case, making the member abstract causes existing subclasses to fail to load.