Movatterモバイル変換


[0]ホーム

URL:


Skip to main contentSkip to in-page navigation

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

InvalidOperationException Class

Definition

Namespace:
System
Assemblies:
mscorlib.dll, System.Runtime.dll
Assemblies:
netstandard.dll, System.Runtime.dll
Assembly:
System.Runtime.dll
Assembly:
mscorlib.dll
Assembly:
netstandard.dll
Source:
InvalidOperationException.cs
Source:
InvalidOperationException.cs
Source:
InvalidOperationException.cs
Source:
InvalidOperationException.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

The exception that is thrown when a method call is invalid for the object's current state.

public ref class InvalidOperationException : Exception
public ref class InvalidOperationException : SystemException
public class InvalidOperationException : Exception
public class InvalidOperationException : SystemException
[System.Serializable]public class InvalidOperationException : SystemException
[System.Serializable][System.Runtime.InteropServices.ComVisible(true)]public class InvalidOperationException : SystemException
type InvalidOperationException = class    inherit Exception
type InvalidOperationException = class    inherit SystemException
[<System.Serializable>]type InvalidOperationException = class    inherit SystemException
[<System.Serializable>][<System.Runtime.InteropServices.ComVisible(true)>]type InvalidOperationException = class    inherit SystemException
Public Class InvalidOperationExceptionInherits Exception
Public Class InvalidOperationExceptionInherits SystemException
Inheritance
InvalidOperationException
Inheritance
InvalidOperationException
Derived
Attributes

Remarks

For more information about this API, seeSupplemental API remarks for InvalidOperationException.

Constructors

NameDescription
InvalidOperationException()

Initializes a new instance of theInvalidOperationException class.

InvalidOperationException(SerializationInfo, StreamingContext)
Obsolete.

Initializes a new instance of theInvalidOperationException class with serialized data.

InvalidOperationException(String, Exception)

Initializes a new instance of theInvalidOperationException class with a specified error message and a reference to the inner exception that is the cause of this exception.

InvalidOperationException(String)

Initializes a new instance of theInvalidOperationException class with a specified error message.

Properties

NameDescription
Data

Gets a collection of key/value pairs that provide additional user-defined information about the exception.

(Inherited fromException)
HelpLink

Gets or sets a link to the help file associated with this exception.

(Inherited fromException)
HResult

Gets or sets HRESULT, a coded numerical value that is assigned to a specific exception.

(Inherited fromException)
InnerException

Gets theException instance that caused the current exception.

(Inherited fromException)
Message

Gets a message that describes the current exception.

(Inherited fromException)
Source

Gets or sets the name of the application or the object that causes the error.

(Inherited fromException)
StackTrace

Gets a string representation of the immediate frames on the call stack.

(Inherited fromException)
TargetSite

Gets the method that throws the current exception.

(Inherited fromException)

Methods

NameDescription
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited fromObject)
GetBaseException()

When overridden in a derived class, returns theException that is the root cause of one or more subsequent exceptions.

(Inherited fromException)
GetHashCode()

Serves as the default hash function.

(Inherited fromObject)
GetObjectData(SerializationInfo, StreamingContext)
Obsolete.

When overridden in a derived class, sets theSerializationInfo with information about the exception.

(Inherited fromException)
GetType()

Gets the runtime type of the current instance.

(Inherited fromException)
MemberwiseClone()

Creates a shallow copy of the currentObject.

(Inherited fromObject)
ToString()

Creates and returns a string representation of the current exception.

(Inherited fromException)

Events

NameDescription
SerializeObjectState
Obsolete.

Occurs when an exception is serialized to create an exception state object that contains serialized data about the exception.

(Inherited fromException)

Applies to

See also

Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, seeour contributor guide.

Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?