NotSupportedException NotSupportedException NotSupportedException NotSupportedException Class

定义

当调用的方法不受支持,或试图读取、查找或写入不支持调用功能的流时引发的异常。The exception that is thrown when an invoked method is not supported, or when there is an attempt to read, seek, or write to a stream that does not support the invoked functionality.

public ref class NotSupportedException : SystemException
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class NotSupportedException : SystemException
type NotSupportedException = class
    inherit SystemException
Public Class NotSupportedException
Inherits SystemException
继承
NotSupportedExceptionNotSupportedExceptionNotSupportedExceptionNotSupportedException
派生
属性

注解

NotSupportedException指示调用的方法或属性不存在实现。NotSupportedException indicates that no implementation exists for an invoked method or property.

NotSupportedException使用 COR_E_NOTSUPPORTED 值为0x80131515 的 HRESULT。NotSupportedException uses the HRESULT COR_E_NOTSUPPORTED, which has the value 0x80131515.

有关实例的初始属性值的列表NotSupportedException,请参阅NotSupportedException构造函数。For a list of initial property values for an instance of NotSupportedException, see the NotSupportedException constructors.

引发 NotSupportedException 异常Throwing a NotSupportedException exception

在以下情况下, NotSupportedException你可能会考虑引发异常:You might consider throwing a NotSupportedException exception in the following cases:

  • 您正在实现一个通用接口, 并且这些方法的数量没有有意义的实现。You are implementing a general-purpose interface, and number of the methods have no meaningful implementation. 例如, 如果您创建的是实现IConvertible接口的日期和时间类型, 则对于大多数转换, 将NotSupportedException引发异常。For example, if you are creating a date and time type that implements the IConvertible interface, you would throw a NotSupportedException exception for most of the conversions.

  • 你已继承自抽象类, 该抽象类需要重写若干方法。You've inherited from an abstract class that requires that you override a number of methods. 但是, 你只是为这些的子集提供了一个实现。However, you're only prepared to provide an implementation for a subset of these. 对于您决定不实现的方法, 您可以选择引发NotSupportedExceptionFor the methods that you decide not to implement, you can choose to throw a NotSupportedException.

  • 您正在定义一个通用类型, 该类型具有可有条件地启用操作的状态。You are defining a general-purpose type with a state that enables operations conditionally. 例如, 您的类型可以是只读的, 也可以是读写的。For example, your type can be either read-only or read-write. 在这种情况下:In that case:

    • 如果对象为只读, 则尝试将值分配给实例的属性或修改实例状态的调用方法应引发NotSupportedException异常。If the object is read-only, attempting to assign values to the properties of an instance or call methods that modify instance state should throw a NotSupportedException exception.

    • 应该实现一个属性, 该属性可Boolean返回一个指示特定功能是否可用的值。You should implement a property that returns a Boolean value that indicates whether particular functionality is available. 例如, 对于可为只读或读写的类型, 您可以实现一个IsReadOnly属性, 该属性指示读写方法集是否可用或不可用。For example, for a type that can be either read-only or read-write, you could implement a IsReadOnly property that indicates whether the set of read-write methods are available or unavailable.

处理 NotSupportedException 异常Handling a NotSupportedException exception

NotSupportedException异常指示方法没有实现, 并且不应调用它。The NotSupportedException exception indicates that a method has no implementation and that you should not call it. 不应处理异常。You should not handle the exception. 相反, 您应该执行的操作取决于引发异常的原因: 是完全不存在实现, 还是成员调用与对象的用途不一致 (例如对只读FileStream.Write FileStream对象调用方法.Instead, what you should do depends on the cause of the exception: whether an implementation is completely absent , or the member invocation is inconsistent with the purpose of an object (such as a call to the FileStream.Write method on a read-only FileStream object .

尚未提供实现, 因为无法以有意义的方式执行该操作。An implementation has not been provided because the operation cannot be performed in a meaningful way.
当你在为抽象基类的方法提供实现的对象上调用方法时, 这是一个常见的异常, 或者是实现通用接口的方法, 并且该方法没有有意义的实现。This is a common exception when you are calling methods on an object that provides implementations for the methods of an abstract base class, or that implements a general-purpose interface, and the method has no meaningful implementation.

例如, ConvertIConvertible实现接口, 这意味着它必须包含方法以将每个基元类型转换为其他每个基元类型。For example, the Convert class implements the IConvertible interface, which means that it must include a method to convert every primitive type to every other primitive type. 但是, 其中许多转换都是无法实现的。Many of those conversions, however, are not possible. 因此, 对Convert.ToBoolean(DateTime)方法的调用将NotSupportedException引发异常, 因为在和Boolean值之间没有可能的DateTime转换As a result, a call to the Convert.ToBoolean(DateTime) method, for instance, throws a NotSupportedException exception because there is no possible conversion between a DateTime and a Boolean value

若要消除此异常, 应消除方法调用。To eliminate the exception, you should eliminate the method call.

如果对象的状态为, 则不支持方法调用。The method call is not supported given the state of the object.
你正在尝试调用其功能因对象状态不可用的成员。You are attempting to invoke a member whose functionality is unavailable because of the object's state. 可以通过以下三种方式之一消除异常:You can eliminate the exception in one of three ways:

  • 你事先知道对象的状态, 但你调用了不受支持的方法或属性。You know the state of the object in advance, but you've invoked an unsupported method or property. 在这种情况下, 成员调用是一个错误, 您可以将其删除。In this case, the member invocation is an error, and you can eliminate it.

  • 你事先知道对象的状态 (通常是因为代码已对其进行实例化), 但对象配置不好。You know the state of the object in advance (usually because your code has instantiated it), but the object is mis-configured. 下面的示例说明了此问题。The following example illustrates this issue. 它将创建一个只读FileStream对象, 然后尝试写入该对象。It creates a read-only FileStream object and then attempts to write to it.

    using System;
    using System.IO;
    using System.Text;
    using System.Threading.Tasks;
    
    public class Example
    {
       public static async Task Main()
       {
          Encoding enc = Encoding.Unicode;
          String value = "This is a string to persist.";
          Byte[] bytes  = enc.GetBytes(value);
    
          FileStream fs = new FileStream(@".\TestFile.dat", 
                                         FileMode.Open,
                                         FileAccess.Read);
          Task t = fs.WriteAsync(enc.GetPreamble(), 0, enc.GetPreamble().Length);
          Task t2 = t.ContinueWith( (a) => fs.WriteAsync(bytes, 0, bytes.Length) ); 
          await t2;
          fs.Close();
       }
    }
    // The example displays the following output:
    //    Unhandled Exception: System.NotSupportedException: Stream does not support writing.
    //       at System.IO.Stream.BeginWriteInternal(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state
    //    , Boolean serializeAsynchronously)
    //       at System.IO.FileStream.BeginWrite(Byte[] array, Int32 offset, Int32 numBytes, AsyncCallback userCallback, Object sta
    //    teObject)
    //       at System.IO.Stream.<>c.<BeginEndWriteAsync>b__53_0(Stream stream, ReadWriteParameters args, AsyncCallback callback,
    //    Object state)
    //       at System.Threading.Tasks.TaskFactory`1.FromAsyncTrim[TInstance,TArgs](TInstance thisRef, TArgs args, Func`5 beginMet
    //    hod, Func`3 endMethod)
    //       at System.IO.Stream.BeginEndWriteAsync(Byte[] buffer, Int32 offset, Int32 count)
    //       at System.IO.FileStream.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
    //       at System.IO.Stream.WriteAsync(Byte[] buffer, Int32 offset, Int32 count)
    //       at Example.Main()
    
    Imports System.IO
    Imports System.Text
    Imports System.Threading.Tasks
    
    Module Example
       Public Sub Main()
          Dim enc As Encoding = Encoding.Unicode
          Dim value As String = "This is a string to persist."
          Dim bytes() As Byte = enc.GetBytes(value)
    
          Dim fs As New FileStream(".\TestFile.dat", 
                                   FileMode.Open,
                                   FileAccess.Read)
          Dim t As Task = fs.WriteAsync(enc.GetPreamble(), 0, enc.GetPreamble().Length)
          Dim t2 As Task = t.ContinueWith(Sub(a) fs.WriteAsync(bytes, 0, bytes.Length)) 
          t2.Wait()
          fs.Close()
       End Sub
    End Module
    ' The example displays the following output:
    '    Unhandled Exception: System.NotSupportedException: Stream does not support writing.
    '       at System.IO.Stream.BeginWriteInternal(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state
    '    , Boolean serializeAsynchronously)
    '       at System.IO.FileStream.BeginWrite(Byte[] array, Int32 offset, Int32 numBytes, AsyncCallback userCallback, Object sta
    '    teObject)
    '       at System.IO.Stream.<>c.<BeginEndWriteAsync>b__53_0(Stream stream, ReadWriteParameters args, AsyncCallback callback,
    '    Object state)
    '       at System.Threading.Tasks.TaskFactory`1.FromAsyncTrim[TInstance,TArgs](TInstance thisRef, TArgs args, Func`5 beginMet
    '    hod, Func`3 endMethod)
    '       at System.IO.Stream.BeginEndWriteAsync(Byte[] buffer, Int32 offset, Int32 count)
    '       at System.IO.FileStream.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
    '       at System.IO.Stream.WriteAsync(Byte[] buffer, Int32 offset, Int32 count)
    '       at Example.Main()
    

    可以通过确保实例化对象支持所要的功能来消除异常。You can eliminate the exception by ensuring that the instantiated object supports the functionality you intend. 下面的示例通过FileStream FileStream.FileStream(String, FileMode, FileAccess)向构造函数提供正确的参数来解决只读对象的问题。The following example addresses the problem of the read-only FileStream object by providing the correct arguments to the FileStream.FileStream(String, FileMode, FileAccess) constructor.

  • 您不会提前知道对象的状态, 并且对象不支持特定操作。You don't know the state of the object in advance, and the object doesn't support a particular operation. 在大多数情况下, 对象应包含一个属性或方法, 指示它是否支持一组特定操作。In most cases, the object should include a property or method that indicates whether it supports a particular set of operations. 您可以通过检查对象的值并仅在适当的情况调用成员来消除异常。You can eliminate the exception by checking the value of the object and invoking the member only if appropriate.

    下面的示例定义了DetectEncoding一个方法, 该NotSupportedException方法在尝试读取不支持读取访问权限的流的开头时引发异常。The following example defines a DetectEncoding method that throws a NotSupportedException exception when it attempts to read from the beginning of a stream that does not support read access.

    using System;
    using System.IO;
    using System.Threading.Tasks;
    
    public class Example
    {
       public static async Task Main()
       {
          String name = @".\TestFile.dat";
          var fs = new FileStream(name, 
                                  FileMode.Create,
                                  FileAccess.Write);
             Console.WriteLine("Filename: {0}, Encoding: {1}", 
                               name, await FileUtilities.GetEncodingType(fs));
       }
    }
    
    public class FileUtilities
    {
       public enum EncodingType
       { None = 0, Unknown = -1, Utf8 = 1, Utf16 = 2, Utf32 = 3 }
       
       public async static Task<EncodingType> GetEncodingType(FileStream fs)
       {
          Byte[] bytes = new Byte[4];
          int bytesRead = await fs.ReadAsync(bytes, 0, 4);
          if (bytesRead < 2)
             return EncodingType.None;
          
          if (bytesRead >= 3 & (bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF))
             return EncodingType.Utf8;
          
          if (bytesRead == 4) { 
             var value = BitConverter.ToUInt32(bytes, 0);
             if (value == 0x0000FEFF | value == 0xFEFF0000)
                return EncodingType.Utf32;
          }
          
          var value16 = BitConverter.ToUInt16(bytes, 0);
          if (value16 == (ushort)0xFEFF | value16 == (ushort)0xFFFE) 
             return EncodingType.Utf16;
          
          return EncodingType.Unknown;
       }
    }
    // The example displays the following output:
    //    Unhandled Exception: System.NotSupportedException: Stream does not support reading.
    //       at System.IO.FileStream.BeginRead(Byte[] array, Int32 offset, Int32 numBytes, AsyncCallback callback, Object state)
    //       at System.IO.Stream.<>c.<BeginEndReadAsync>b__46_0(Stream stream, ReadWriteParameters args, AsyncCallback callback, Object state)
    //       at System.Threading.Tasks.TaskFactory`1.FromAsyncTrim[TInstance, TArgs](TInstance thisRef, TArgs args, Func`5 beginMethod, Func`3 endMethod)
    //       at System.IO.Stream.BeginEndReadAsync(Byte[] buffer, Int32 offset, Int32 count)
    //       at System.IO.FileStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
    //       at System.IO.Stream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count)
    //       at FileUtilities.GetEncodingType(FileStream fs) in C:\Work\docs\program.cs:line 26
    //       at Example.Main() in C:\Work\docs\program.cs:line 13
    //       at Example.<Main>()
    
    Imports System.IO
    Imports System.Threading.Tasks
    
    Module Example
       Public Sub Main()
          Dim name As String = ".\TestFile.dat"
          Dim fs As New FileStream(name, 
                                   FileMode.Create,
                                   FileAccess.Write)
          Console.WriteLine("Filename: {0}, Encoding: {1}", 
                            name, FileUtilities.GetEncodingType(fs))
       End Sub
    End Module
    
    Public Class FileUtilities
       Public Enum EncodingType As Integer
          None = 0
          Unknown = -1
          Utf8 = 1
          Utf16 = 2
          Utf32 = 3
       End Enum
       
       Public Shared Function GetEncodingType(fs As FileStream) As EncodingType
          Dim bytes(3) As Byte
          Dim t As Task(Of Integer) = fs.ReadAsync(bytes, 0, 4)
          t.Wait()
          Dim bytesRead As Integer = t.Result
          If bytesRead < 2 Then Return EncodingType.None
          
          If bytesRead >= 3 And (bytes(0) = &hEF AndAlso bytes(1) = &hBB AndAlso bytes(2) = &hBF) Then
             Return EncodingType.Utf8
          End If
          
          If bytesRead = 4 Then 
             Dim value As UInteger = BitConverter.ToUInt32(bytes, 0)
             If value = &h0000FEFF Or value = &hFEFF0000 Then
                Return EncodingType.Utf32
             End If
          End If
          
          Dim value16 As UInt16 = BitConverter.ToUInt16(bytes, 0)
          If value16 = &hFEFF Or value16 = &hFFFE Then 
             Return EncodingType.Utf16
          End If
          
          Return EncodingType.Unknown
       End Function
    End Class
    ' The example displays the following output:
    '    Unhandled Exception: System.NotSupportedException: Stream does not support reading.
    '       at System.IO.Stream.BeginReadInternal(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state,
    '     Boolean serializeAsynchronously)
    '       at System.IO.FileStream.BeginRead(Byte[] array, Int32 offset, Int32 numBytes, AsyncCallback userCallback, Object stat
    '    eObject)
    '       at System.IO.Stream.<>c.<BeginEndReadAsync>b__43_0(Stream stream, ReadWriteParameters args, AsyncCallback callback, O
    '    bject state)
    '       at System.Threading.Tasks.TaskFactory`1.FromAsyncTrim[TInstance,TArgs](TInstance thisRef, TArgs args, Func`5 beginMet
    '    hod, Func`3 endMethod)
    '       at System.IO.Stream.BeginEndReadAsync(Byte[] buffer, Int32 offset, Int32 count)
    '       at System.IO.FileStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
    '       at System.IO.Stream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count)
    '       at FileUtilities.GetEncodingType(FileStream fs)
    '       at Example.Main()
    

    如果流是只读的, 则可以通过检查FileStream.CanRead属性的值并退出方法来消除异常。You can eliminate the exception by examining the value of the FileStream.CanRead property and exiting the method if the stream is read-only.

       public static async Task<EncodingType> GetEncodingType(FileStream fs)
       {
          if (!fs.CanRead) 
             return EncodingType.Unknown;
    
          Byte[] bytes = new Byte[4];
          int bytesRead = await fs.ReadAsync(bytes, 0, 4);
          if (bytesRead < 2)
             return EncodingType.None;
          
          if (bytesRead >= 3 & (bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF))
             return EncodingType.Utf8;
          
          if (bytesRead == 4) { 
             var value = BitConverter.ToUInt32(bytes, 0);
             if (value == 0x0000FEFF | value == 0xFEFF0000)
                return EncodingType.Utf32;
          }
          
          var value16 = BitConverter.ToUInt16(bytes, 0);
          if (value16 == (ushort)0xFEFF | value16 == (ushort)0xFFFE) 
             return EncodingType.Utf16;
          
          return EncodingType.Unknown;
       }
    }
    // The example displays the following output:
    //       Filename: .\TestFile.dat, Encoding: Unknown
    
    Public Class FileUtilities
       Public Enum EncodingType As Integer
          None = 0
          Unknown = -1
          Utf8 = 1
          Utf16 = 2
          Utf32 = 3
       End Enum
       
       Public Shared Function GetEncodingType(fs As FileStream) As EncodingType
          If Not fs.CanRead Then
             Return EncodingType.Unknown
    
          Dim bytes(3) As Byte
          Dim t As Task(Of Integer) = fs.ReadAsync(bytes, 0, 4)
          t.Wait()
          Dim bytesRead As Integer = t.Result
          If bytesRead < 2 Then Return EncodingType.None
          
          If bytesRead >= 3 And (bytes(0) = &hEF AndAlso bytes(1) = &hBB AndAlso bytes(2) = &hBF) Then
             Return EncodingType.Utf8
          End If
          
          If bytesRead = 4 Then 
             Dim value As UInteger = BitConverter.ToUInt32(bytes, 0)
             If value = &h0000FEFF Or value = &hFEFF0000 Then
                Return EncodingType.Utf32
             End If
          End If
          
          Dim value16 As UInt16 = BitConverter.ToUInt16(bytes, 0)
          If value16 = &hFEFF Or value16 = &hFFFE Then 
             Return EncodingType.Utf16
          End If
          
          Return EncodingType.Unknown
       End Function
    End Class
    ' The example displays the following output:
    '       Filename: .\TestFile.dat, Encoding: Unknown
    

NotSupportedException异常与另外两种异常类型密切相关;The NotSupportedException exception is closely related to two other exception types;

NotImplementedExceptionNotImplementedException.
如果方法可以实现但不是, 则会引发此异常, 这可能是因为成员将在更高版本中实现, 成员在特定平台上不可用, 或者成员属于抽象类, 派生类必须提供 implementation.This exception is thrown when a method could be implemented but is not, either because the member will be implemented in a later version, the member is not available on a particular platform, or the member belongs to an abstract class and a derived class must provide an implementation.

InvalidOperationException
在通常情况下, 对象可能会执行请求的操作, 并且对象状态确定是否可以执行该操作时, 将引发此异常。This exception is thrown in scenarios in which it is generally sometimes possible for the object to perform the requested operation, and the object state determines whether the operation can be performed.

.NET Compact Framework 说明.NET Compact Framework notes

当使用 .NET Compact Framework.NET Compact Framework 并对本机函数使用 P/Invoke 时,如果出现以下情况,则会引发此异常:When working with the .NET Compact Framework.NET Compact Framework and using P/Invoke on a native function, this exception may be thrown if:

  • 托管代码中的声明不正确。The declaration in managed code is incorrect.

  • .NET Compact Framework.NET Compact Framework 不支持尝试执行的操作。The .NET Compact Framework.NET Compact Framework does not support what you are trying to do.

  • DLL 名称在导出时难以分辨。The DLL names are mangled on export.

如果引发NotSupportedException了异常, 请检查:If a NotSupportedException exception is thrown, check:

  • 任何违反 .NET Compact Framework.NET Compact Framework P/Invoke 限制的行为。For any violations of the .NET Compact Framework.NET Compact Framework P/Invoke restrictions.

  • 任何需要预分配内存的参数。For any arguments that require pre-allocated memory. 如果存在这种情况,应传递对现有变量的引用。If these exist, you should pass a reference to an existing variable.

  • 导出的函数的名称正确。That the names of the exported functions are correct. 这可以通过DumpBin进行验证。This can be verified with DumpBin.exe.

  • 您没有尝试传递过多的参数。That you are not attempting to pass too many arguments.

构造函数

NotSupportedException() NotSupportedException() NotSupportedException() NotSupportedException()

初始化 NotSupportedException 类的新实例,将新实例的 Message 属性设置为系统提供的描述错误的消息。Initializes a new instance of the NotSupportedException class, setting the Message property of the new instance to a system-supplied message that describes the error. 此消息将当前系统区域性考虑在内。This message takes into account the current system culture.

NotSupportedException(SerializationInfo, StreamingContext) NotSupportedException(SerializationInfo, StreamingContext) NotSupportedException(SerializationInfo, StreamingContext) NotSupportedException(SerializationInfo, StreamingContext)

用序列化数据初始化 NotSupportedException 类的新实例。Initializes a new instance of the NotSupportedException class with serialized data.

NotSupportedException(String) NotSupportedException(String) NotSupportedException(String) NotSupportedException(String)

用指定的错误消息初始化 NotSupportedException 类的新实例。Initializes a new instance of the NotSupportedException class with a specified error message.

NotSupportedException(String, Exception) NotSupportedException(String, Exception) NotSupportedException(String, Exception) NotSupportedException(String, Exception)

使用指定的错误消息和对作为此异常原因的内部异常的引用来初始化 NotSupportedException 类的新实例。Initializes a new instance of the NotSupportedException class with a specified error message and a reference to the inner exception that is the cause of this exception.

属性

Data Data Data Data

获取提供有关异常的其他用户定义信息的键/值对集合。Gets a collection of key/value pairs that provide additional user-defined information about the exception.

(Inherited from Exception)
HelpLink HelpLink HelpLink HelpLink

获取或设置指向与此异常关联的帮助文件链接。Gets or sets a link to the help file associated with this exception.

(Inherited from Exception)
HResult HResult HResult HResult

获取或设置 HRESULT(一个分配给特定异常的编码数字值)。Gets or sets HRESULT, a coded numerical value that is assigned to a specific exception.

(Inherited from Exception)
InnerException InnerException InnerException InnerException

获取导致当前异常的 Exception 实例。Gets the Exception instance that caused the current exception.

(Inherited from Exception)
Message Message Message Message

获取描述当前异常的消息。Gets a message that describes the current exception.

(Inherited from Exception)
Source Source Source Source

获取或设置导致错误的应用程序或对象的名称。Gets or sets the name of the application or the object that causes the error.

(Inherited from Exception)
StackTrace StackTrace StackTrace StackTrace

获取调用堆栈上的即时框架字符串表示形式。Gets a string representation of the immediate frames on the call stack.

(Inherited from Exception)
TargetSite TargetSite TargetSite TargetSite

获取引发当前异常的方法。Gets the method that throws the current exception.

(Inherited from Exception)

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetBaseException() GetBaseException() GetBaseException() GetBaseException()

当在派生类中重写时,返回 Exception,它是一个或多个并发的异常的根源。When overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions.

(Inherited from Exception)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext)

当在派生类中重写时,用关于异常的信息设置 SerializationInfoWhen overridden in a derived class, sets the SerializationInfo with information about the exception.

(Inherited from Exception)
GetType() GetType() GetType() GetType()

获取当前实例的运行时类型。Gets the runtime type of the current instance.

(Inherited from Exception)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

创建并返回当前异常的字符串表示形式。Creates and returns a string representation of the current exception.

(Inherited from Exception)

事件

SerializeObjectState SerializeObjectState SerializeObjectState SerializeObjectState

当异常被序列化用来创建包含有关该异常的徐列出数据的异常状态对象时会出现该问题。Occurs when an exception is serialized to create an exception state object that contains serialized data about the exception.

(Inherited from Exception)

适用于

另请参阅