SerializationInfo.GetDateTime(String) 方法

定义

DateTime 存储中检索一个 SerializationInfo 值。Retrieves a DateTime value from the SerializationInfo store.

public:
 DateTime GetDateTime(System::String ^ name);
public DateTime GetDateTime (string name);
member this.GetDateTime : string -> DateTime
Public Function GetDateTime (name As String) As DateTime

参数

name
String

与要检索的值关联的名称。The name associated with the value to retrieve.

返回

DateTime

name 关联的 DateTime 值。The DateTime value associated with name.

例外

namenullname is null.

name 关联的值不能转换为 DateTime 值。The value associated with name cannot be converted to a DateTime value.

当前实例中没有找到具有指定名称的元素。An element with the specified name is not found in the current instance.

注解

如果值为 DateTime ,或可以转换为,则返回该值 DateTime ; 否则, InvalidCastException 将引发。If the value is a DateTime, or can be converted to a DateTime, that value is returned; otherwise, a InvalidCastException is thrown. 所有转换都是通过与此关联的来完成的 IFormatterConverter SerializationInfoAll conversions are done by the IFormatterConverter associated with this SerializationInfo.

适用于