PathTooLongException 构造函数

定义

初始化 PathTooLongException 类的新实例。Initializes a new instance of the PathTooLongException class.

重载

PathTooLongException()

初始化 PathTooLongException 类的新实例,使其 HRESULT 设置为 COR_E_PATHTOOLONG。Initializes a new instance of the PathTooLongException class with its HRESULT set to COR_E_PATHTOOLONG.

PathTooLongException(String)

初始化 PathTooLongException 类的新实例,使其消息字符串设置为 message,而其 HRESULT 设置为 COR_E_PATHTOOLONG。Initializes a new instance of the PathTooLongException class with its message string set to message and its HRESULT set to COR_E_PATHTOOLONG.

PathTooLongException(SerializationInfo, StreamingContext)

用指定的序列化和上下文信息初始化 PathTooLongException 类的新实例。Initializes a new instance of the PathTooLongException class with the specified serialization and context information.

PathTooLongException(String, Exception)

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

PathTooLongException()

初始化 PathTooLongException 类的新实例,使其 HRESULT 设置为 COR_E_PATHTOOLONG。Initializes a new instance of the PathTooLongException class with its HRESULT set to COR_E_PATHTOOLONG.

public:
 PathTooLongException();
public PathTooLongException ();
Public Sub New ()

注解

此构造函数将Message新实例的属性初始化为系统提供的描述错误的消息, 如 "提供的路径太长"。This constructor initializes the Message property of the new instance to a system-supplied message that describes the error, such as "The supplied path is too long." 此消息将当前系统区域性考虑在内。This message takes into account the current system culture.

另请参阅

PathTooLongException(String)

初始化 PathTooLongException 类的新实例,使其消息字符串设置为 message,而其 HRESULT 设置为 COR_E_PATHTOOLONG。Initializes a new instance of the PathTooLongException class with its message string set to message and its HRESULT set to COR_E_PATHTOOLONG.

public:
 PathTooLongException(System::String ^ message);
public PathTooLongException (string message);
new System.IO.PathTooLongException : string -> System.IO.PathTooLongException
Public Sub New (message As String)

参数

message
String

描述该错误的 StringA String that describes the error. message 的内容被设计为人可理解的形式。The content of message is intended to be understood by humans. 此构造函数的调用方需要确保此字符串已针对当前系统区域性进行了本地化。The caller of this constructor is required to ensure that this string has been localized for the current system culture.

注解

此构造函数使用Message message初始化新实例的属性。This constructor initializes the Message property of the new instance using message.

另请参阅

PathTooLongException(SerializationInfo, StreamingContext)

用指定的序列化和上下文信息初始化 PathTooLongException 类的新实例。Initializes a new instance of the PathTooLongException class with the specified serialization and context information.

protected:
 PathTooLongException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected PathTooLongException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.IO.PathTooLongException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.IO.PathTooLongException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

参数

info
SerializationInfo

包含有关所引发异常的序列化对象数据的 SerializationInfoThe SerializationInfo that holds the serialized object data about the exception being thrown.

context
StreamingContext

StreamingContext,它包含关于源或目标的上下文信息。The StreamingContext that contains contextual information about the source or destination.

另请参阅

PathTooLongException(String, Exception)

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

public:
 PathTooLongException(System::String ^ message, Exception ^ innerException);
public PathTooLongException (string message, Exception innerException);
new System.IO.PathTooLongException : string * Exception -> System.IO.PathTooLongException
Public Sub New (message As String, innerException As Exception)

参数

message
String

描述该错误的 StringA String that describes the error. message 的内容被设计为人可理解的形式。The content of message is intended to be understood by humans. 此构造函数的调用方需要确保此字符串已针对当前系统区域性进行了本地化。The caller of this constructor is required to ensure that this string has been localized for the current system culture.

innerException
Exception

导致当前异常的异常。The exception that is the cause of the current exception. 如果 innerException 参数不为 null,则当前异常将在处理内部异常的 catch 块中引发。If the innerException parameter is not null, the current exception is raised in a catch block that handles the inner exception.

注解

因前一个异常而直接引发的异常应在 InnerException 属性中包含对前一个异常的引用。An exception that is thrown as a direct result of a previous exception should include a reference to the previous exception in the InnerException property. InnerException 属性返回的值与传递到构造函数中的值相同;或者,如果 null 属性没有向构造函数提供内部异常值,则为 InnerExceptionThe InnerException property returns the same value that is passed into the constructor, or null if the InnerException property does not supply the inner exception value to the constructor.

下表显示 PathTooLongException 的实例的初始属性值。The following table shows the initial property values for an instance of PathTooLongException.

PropertyProperty “值”Value
InnerException 内部异常引用。The inner exception reference.
Message 错误消息字符串。The error message string.

有关内部异常的详细信息, 请InnerException参阅。For more information on inner exceptions, see InnerException.

另请参阅

适用于