CultureNotFoundException CultureNotFoundException CultureNotFoundException CultureNotFoundException Class

定义

当方法尝试构造不可用的区域性时引发的异常。The exception that is thrown when a method attempts to construct a culture that is not available.

public ref class CultureNotFoundException : ArgumentException
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CultureNotFoundException : ArgumentException
type CultureNotFoundException = class
    inherit ArgumentException
    interface ISerializable
Public Class CultureNotFoundException
Inherits ArgumentException
继承
属性
实现

注解

当最终在方法内尝试构造无效区域性时, 将引发异常。CultureNotFoundExceptionA CultureNotFoundException exception is thrown whenever the construction of an invalid culture is eventually attempted within a method. 最常见的情况是, 在调用以下方法之一无法创建或返回区域性时, 会引发此异常:Most commonly, this exception is thrown when a call to one of the following methods fails to create or return a culture:

警告

在 Windows 7 及更高版本的操作系统上, .NET Framework 从操作系统检索区域性数据。On Windows 7 and later operating systems, the .NET Framework retrieves culture data from the operating system. 如果操作系统找不到该区域性, 并且该区域性不是自定义区域性或替换区域性, 则会引发异常。CultureNotFoundExceptionThe CultureNotFoundException exception is thrown if the operating system is unable to find the culture, and the culture is not a custom culture or a replacement culture.

如果调用代码尝试使用区域性名称实例CultureInfo化对象, 则该InvalidCultureName属性将包含HasValue无效名称, Nullable<T>并且由InvalidCultureId属性返回的对象的属性为false.If the calling code attempted to instantiate a CultureInfo object by using a culture name, the InvalidCultureName property contains the invalid name, and the HasValue property of the Nullable<T> object returned by the InvalidCultureId property is false. 如果调用代码尝试使用区域性标识符来CultureInfo实例化对象Value , 则由InvalidCultureId属性返回的Nullable<T>对象的属性包含无效的标识符和值。 InvalidCultureName属性为nullIf the calling code attempted to instantiate a CultureInfo object by using a culture identifier, the Value property of the Nullable<T> object returned by the InvalidCultureId property contains the invalid identifier, and the value of the InvalidCultureName property is null.

CultureNotFoundException使用 COR_E_ARGUMENT 值为0x80070057 的 HRESULT。CultureNotFoundException uses the HRESULT COR_E_ARGUMENT, which has the value 0x80070057.

构造函数

CultureNotFoundException() CultureNotFoundException() CultureNotFoundException() CultureNotFoundException()

初始化 CultureNotFoundException 类的新实例,将其消息字符串设置为系统提供的消息。Initializes a new instance of the CultureNotFoundException class with its message string set to a system-supplied message.

CultureNotFoundException(SerializationInfo, StreamingContext) CultureNotFoundException(SerializationInfo, StreamingContext) CultureNotFoundException(SerializationInfo, StreamingContext) CultureNotFoundException(SerializationInfo, StreamingContext)

使用指定的序列化数据和上下文初始化 CultureNotFoundException 类的新实例。Initializes a new instance of the CultureNotFoundException class using the specified serialization data and context.

CultureNotFoundException(String) CultureNotFoundException(String) CultureNotFoundException(String) CultureNotFoundException(String)

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

CultureNotFoundException(String, Exception) CultureNotFoundException(String, Exception) CultureNotFoundException(String, Exception) CultureNotFoundException(String, Exception)

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

CultureNotFoundException(String, Int32, Exception) CultureNotFoundException(String, Int32, Exception) CultureNotFoundException(String, Int32, Exception) CultureNotFoundException(String, Int32, Exception)

使用指定的错误消息、无效的区域性 ID 和对导致此异常的内部异常的引用来初始化 CultureNotFoundException 类的新实例。Initializes a new instance of the CultureNotFoundException class with a specified error message, the invalid Culture ID, and a reference to the inner exception that is the cause of this exception.

CultureNotFoundException(String, Int32, String) CultureNotFoundException(String, Int32, String) CultureNotFoundException(String, Int32, String) CultureNotFoundException(String, Int32, String)

使用指定的错误消息、无效的区域性 ID 和导致此异常的参数的名称来初始化 CultureNotFoundException 类的新实例。Initializes a new instance of the CultureNotFoundException class with a specified error message, the invalid Culture ID, and the name of the parameter that is the cause this exception.

CultureNotFoundException(String, String) CultureNotFoundException(String, String) CultureNotFoundException(String, String) CultureNotFoundException(String, String)

使用指定的错误消息和导致此异常的参数的名称来初始化 CultureNotFoundException 类的新实例。Initializes a new instance of the CultureNotFoundException class with a specified error message and the name of the parameter that is the cause this exception.

CultureNotFoundException(String, String, Exception) CultureNotFoundException(String, String, Exception) CultureNotFoundException(String, String, Exception) CultureNotFoundException(String, String, Exception)

使用指定的错误消息、无效的区域性名称和对导致此异常的内部异常的引用来初始化 CultureNotFoundException 类的新实例。Initializes a new instance of the CultureNotFoundException class with a specified error message, the invalid Culture Name, and a reference to the inner exception that is the cause of this exception.

CultureNotFoundException(String, String, String) CultureNotFoundException(String, String, String) CultureNotFoundException(String, String, String) CultureNotFoundException(String, String, String)

使用指定的错误消息、无效的区域性名称和导致此异常的参数的名称来初始化 CultureNotFoundException 类的新实例。Initializes a new instance of the CultureNotFoundException class with a specified error message, the invalid Culture Name, and the name of the parameter that is the cause 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)
InvalidCultureId InvalidCultureId InvalidCultureId InvalidCultureId

获取找不到的区域性标识符。Gets the culture identifier that cannot be found.

InvalidCultureName InvalidCultureName InvalidCultureName InvalidCultureName

获取找不到的区域性名称。Gets the culture name that cannot be found.

Message Message Message Message

获取解释异常原因的错误消息。Gets the error message that explains the reason for the exception.

ParamName ParamName ParamName ParamName

获取导致该异常的参数的名称。Gets the name of the parameter that causes this exception.

(Inherited from ArgumentException)
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)

设置带有参数名和附加异常信息的 SerializationInfo 对象。Sets the SerializationInfo object with the parameter name and additional exception information.

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)

适用于