CultureNotFoundException 类
定义
当方法尝试构造不可用的区域性时引发的异常。The exception that is thrown when a method attempts to construct a culture that is not available.
public ref class CultureNotFoundException : ArgumentException
public class CultureNotFoundException : ArgumentException
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CultureNotFoundException : ArgumentException
type CultureNotFoundException = class
inherit ArgumentException
type CultureNotFoundException = class
inherit ArgumentException
interface ISerializable
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CultureNotFoundException = class
inherit ArgumentException
interface ISerializable
Public Class CultureNotFoundException
Inherits ArgumentException
- 继承
- 继承
- 属性
- 实现
注解
CultureNotFoundException当最终在方法内尝试构造无效区域性时,将引发异常。A 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:
CultureInfo.CultureInfo 函数.CultureInfo.CultureInfo constructors.
CultureInfo.CreateSpecificCulture 方法。The CultureInfo.CreateSpecificCulture method.
CultureInfo.GetCultureInfo 方法。The CultureInfo.GetCultureInfo method.
警告
在 Windows 7 及更高版本的操作系统上,.NET Framework 从操作系统检索区域性数据。On Windows 7 and later operating systems, the .NET Framework retrieves culture data from the operating system. CultureNotFoundException如果操作系统找不到该区域性,并且该区域性不是自定义区域性或替换区域性,则会引发异常。The 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 Nullable<T> 由属性返回的对象的属性 InvalidCultureId 包含无效的标识符,并且属性的值 InvalidCultureName 为 null
。If 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 使用 HRESULT COR_E_ARGUMENT,其值为0x80070057。CultureNotFoundException uses the HRESULT COR_E_ARGUMENT, which has the value 0x80070057.
构造函数
CultureNotFoundException() |
初始化 CultureNotFoundException 类的新实例,将其消息字符串设置为系统提供的消息。Initializes a new instance of the CultureNotFoundException class with its message string set to a system-supplied message. |
CultureNotFoundException(SerializationInfo, StreamingContext) |
使用指定的序列化数据和上下文初始化 CultureNotFoundException 类的新实例。Initializes a new instance of the CultureNotFoundException class using the specified serialization data and context. |
CultureNotFoundException(String) |
使用指定的错误消息初始化 CultureNotFoundException 类的新实例。Initializes a new instance of the CultureNotFoundException class with the specified error message. |
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) |
使用指定的错误消息、无效的区域性 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) |
使用指定的错误消息、无效的区域性 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 类的新实例。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 类的新实例。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 类的新实例。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 |
获取键/值对的集合,这些键/值对提供有关该异常的其他用户定义信息。Gets a collection of key/value pairs that provide additional user-defined information about the exception. (继承自 Exception) |
HelpLink |
获取或设置指向与此异常关联的帮助文件链接。Gets or sets a link to the help file associated with this exception. (继承自 Exception) |
HResult |
获取或设置 HRESULT(一个分配给特定异常的编码数字值)。Gets or sets HRESULT, a coded numerical value that is assigned to a specific exception. (继承自 Exception) |
InnerException |
获取导致当前异常的 Exception 实例。Gets the Exception instance that caused the current exception. (继承自 Exception) |
InvalidCultureId |
获取找不到的区域性标识符。Gets the culture identifier that cannot be found. |
InvalidCultureName |
获取找不到的区域性名称。Gets the culture name that cannot be found. |
Message |
获取解释异常原因的错误消息。Gets the error message that explains the reason for the exception. |
ParamName |
获取导致该异常的参数的名称。Gets the name of the parameter that causes this exception. (继承自 ArgumentException) |
Source |
获取或设置导致错误的应用程序或对象的名称。Gets or sets the name of the application or the object that causes the error. (继承自 Exception) |
StackTrace |
获取调用堆栈上的即时框架字符串表示形式。Gets a string representation of the immediate frames on the call stack. (继承自 Exception) |
TargetSite |
获取引发当前异常的方法。Gets the method that throws the current exception. (继承自 Exception) |
方法
Equals(Object) |
确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object. (继承自 Object) |
GetBaseException() |
当在派生类中重写时,返回 Exception,它是一个或多个并发的异常的根本原因。When overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions. (继承自 Exception) |
GetHashCode() |
作为默认哈希函数。Serves as the default hash function. (继承自 Object) |
GetObjectData(SerializationInfo, StreamingContext) |
设置带有参数名和附加异常信息的 SerializationInfo 对象。Sets the SerializationInfo object with the parameter name and additional exception information. |
GetObjectData(SerializationInfo, StreamingContext) |
设置带有参数名和附加异常信息的 SerializationInfo 对象。Sets the SerializationInfo object with the parameter name and additional exception information. (继承自 ArgumentException) |
GetType() |
获取当前实例的运行时类型。Gets the runtime type of the current instance. (继承自 Exception) |
MemberwiseClone() |
创建当前 Object 的浅表副本。Creates a shallow copy of the current Object. (继承自 Object) |
ToString() |
创建并返回当前异常的字符串表示形式。Creates and returns a string representation of the current exception. (继承自 Exception) |
事件
SerializeObjectState |
当异常被序列化用来创建包含有关该异常的徐列出数据的异常状态对象时会出现该问题。Occurs when an exception is serialized to create an exception state object that contains serialized data about the exception. (继承自 Exception) |