TimeSpanSecondsOrInfiniteConverter.ConvertFrom(ITypeDescriptorContext, CultureInfo, Object) 方法
定义
public:
override System::Object ^ ConvertFrom(System::ComponentModel::ITypeDescriptorContext ^ ctx, System::Globalization::CultureInfo ^ ci, System::Object ^ data);
public override object ConvertFrom (System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object data);
override this.ConvertFrom : System.ComponentModel.ITypeDescriptorContext * System.Globalization.CultureInfo * obj -> obj
Public Overrides Function ConvertFrom (ctx As ITypeDescriptorContext, ci As CultureInfo, data As Object) As Object
参数
用于类型转换的 ITypeDescriptorContext 对象。The ITypeDescriptorContext object used for type conversions.
- ci
- CultureInfo
转换期间使用的 CultureInfo 对象。The CultureInfo object used during conversion.
返回
如果 data 参数是 MaxValue“infinite”,则为 String;否则为以秒表示 data 参数的 TimeSpan。The MaxValue, if the data parameter is the String "infinite"; otherwise, the TimeSpan representing the data parameter in seconds.
示例
请参阅和类中的代码 InfiniteTimeSpanConverter 示例 TimeSpanMinutesConverter 。Refer to the code examples in the InfiniteTimeSpanConverter and TimeSpanMinutesConverter classes.
注解
ConvertFrom从配置文件读取时,系统使用将值转换为 String TimeSpan ,或将 String "无限大" 转换为 MaxValue 。The system uses ConvertFrom when reading from a configuration file to convert a String value to TimeSpan, or the String "infinite" to MaxValue.