StringArrayConverter.ConvertFrom(ITypeDescriptorContext, CultureInfo, Object) 方法

定义

将指定的逗号分隔的字符串转换为字符串数组。Converts the specified comma-separated string into an array of strings.

public:
 override System::Object ^ ConvertFrom(System::ComponentModel::ITypeDescriptorContext ^ context, System::Globalization::CultureInfo ^ culture, System::Object ^ value);
public override object ConvertFrom (System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value);
override this.ConvertFrom : System.ComponentModel.ITypeDescriptorContext * System.Globalization.CultureInfo * obj -> obj
Public Overrides Function ConvertFrom (context As ITypeDescriptorContext, culture As CultureInfo, value As Object) As Object

参数

context
ITypeDescriptorContext

一个提供格式上下文的 ITypeDescriptorContext 对象,可用来提取有关调用此转换器的环境的附加信息。An ITypeDescriptorContext object that provides a format context that can be used to extract additional information about the environment from which this converter is invoked. 此参数或其属性可以为 nullThis parameter or properties of this parameter can be null.

culture
CultureInfo

CultureInfo 对象。A CultureInfo object. 如果为 null,则使用当前区域性。If null, the current culture is used.

value
Object

要转换的 ObjectThe Object to convert.

返回

Object

表示转换的 valueObjectAn Object that represents the converted value.

例外

由于 value 不是字符串,所以无法执行转换。The conversion cannot be performed because value is not a string.

注解

ConvertFrom方法将表示以逗号分隔的字符串的对象分析为字符串数组。The ConvertFrom method parses an object that represents a comma-separated string into an array of strings. 在调用此方法之前,您可以调用 CanConvertFrom 方法来确定由指定的对象是否 value 可以转换为字符串数组。Prior to calling this method, you can call the CanConvertFrom method to determine whether the object specified by value can be converted to an array of strings.

若要将字符串数组转换为逗号分隔的字符串,请使用 ConvertTo 方法。To convert an array of strings into a comma-separated string, use the ConvertTo method.

适用于

另请参阅