TimeSpanMinutesConverter.ConvertFrom Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
Parameters
The ITypeDescriptorContext object used for type conversions.
- ci
- CultureInfo
The CultureInfo object used during conversion.
Returns
The TimeSpan representing the data
parameter in minutes.
Examples
The following code example shows how to customize the ConvertFrom method.
public override object ConvertFrom(
ITypeDescriptorContext ctx, CultureInfo ci, object data)
{
long min = long.Parse((string)data,
CultureInfo.InvariantCulture);
return TimeSpan.FromMinutes((double)min);
}
Public Overrides Function ConvertFrom( _
ByVal ctx As ITypeDescriptorContext, _
ByVal ci As CultureInfo, ByVal data As Object) As Object
Dim min As Long = _
Long.Parse(CStr(data), CultureInfo.InvariantCulture)
Return TimeSpan.FromMinutes(System.Convert.ToDouble(min))
End Function 'ConvertFrom
Remarks
The system uses the ConvertFrom method when reading from a configuration file to convert a String value to TimeSpan.
Applies to
Colaborar con nosotros en GitHub
El origen de este contenido se puede encontrar en GitHub, donde también puede crear y revisar problemas y solicitudes de incorporación de cambios. Para más información, consulte nuestra guía para colaboradores.