TypeConverter.ConvertFromString Método
Definição
Converte o texto especificado em um objeto.Converts the specified text to an object.
Sobrecargas
| ConvertFromString(ITypeDescriptorContext, CultureInfo, String) |
Converte o texto fornecido em um objeto, usando o contexto e a informação de cultura especificados.Converts the given text to an object, using the specified context and culture information. |
| ConvertFromString(String) |
Converte o texto especificado em um objeto.Converts the specified text to an object. |
| ConvertFromString(ITypeDescriptorContext, String) |
Converte o texto fornecido em um objeto, usando o contexto especificado.Converts the given text to an object, using the specified context. |
ConvertFromString(ITypeDescriptorContext, CultureInfo, String)
Converte o texto fornecido em um objeto, usando o contexto e a informação de cultura especificados.Converts the given text to an object, using the specified context and culture information.
public:
System::Object ^ ConvertFromString(System::ComponentModel::ITypeDescriptorContext ^ context, System::Globalization::CultureInfo ^ culture, System::String ^ text);
public object ConvertFromString (System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, string text);
member this.ConvertFromString : System.ComponentModel.ITypeDescriptorContext * System.Globalization.CultureInfo * string -> obj
Public Function ConvertFromString (context As ITypeDescriptorContext, culture As CultureInfo, text As String) As Object
Parâmetros
- context
- ITypeDescriptorContext
Um ITypeDescriptorContext que fornece um contexto de formato.An ITypeDescriptorContext that provides a format context.
- culture
- CultureInfo
Um CultureInfo.A CultureInfo. Se null for passado, a cultura atual será assumida.If null is passed, the current culture is assumed.
Retornos
Um Object que representa o texto convertido.An Object that represents the converted text.
Exceções
A conversão não pode ser executada.The conversion cannot be performed.
Comentários
Uma exceção será gerada se a cadeia de caracteres não puder ser convertida no objeto apropriado.An exception is raised if the string cannot be converted into the appropriate object. A implementação padrão sempre retorna null.The default implementation always returns null.
Use o context parâmetro para extrair informações adicionais sobre o ambiente do qual esse conversor é invocado.Use the context parameter to extract additional information about the environment from which this converter is invoked. Esse parâmetro pode ser null , portanto, sempre verifique.This parameter can be null, so always check it. Além disso, as propriedades no objeto de contexto podem retornar null.Also, properties on the context object can return null.
Confira também
Aplica-se a
ConvertFromString(String)
Converte o texto especificado em um objeto.Converts the specified text to an object.
public:
System::Object ^ ConvertFromString(System::String ^ text);
public object ConvertFromString (string text);
member this.ConvertFromString : string -> obj
Public Function ConvertFromString (text As String) As Object
Parâmetros
- text
- String
A representação de texto do objeto a ser convertido.The text representation of the object to convert.
Retornos
Um Object que representa o texto convertido.An Object that represents the converted text.
Exceções
A cadeia de caracteres não pode ser convertida em objeto apropriado.The string cannot be converted into the appropriate object.
Exemplos
Para obter um exemplo dessa função, consulte a TypeConverter classe.For an example of this function, see the TypeConverter class.
Comentários
A implementação padrão sempre retorna null.The default implementation always returns null.
Aplica-se a
ConvertFromString(ITypeDescriptorContext, String)
Converte o texto fornecido em um objeto, usando o contexto especificado.Converts the given text to an object, using the specified context.
public:
System::Object ^ ConvertFromString(System::ComponentModel::ITypeDescriptorContext ^ context, System::String ^ text);
public object ConvertFromString (System.ComponentModel.ITypeDescriptorContext context, string text);
member this.ConvertFromString : System.ComponentModel.ITypeDescriptorContext * string -> obj
Public Function ConvertFromString (context As ITypeDescriptorContext, text As String) As Object
Parâmetros
- context
- ITypeDescriptorContext
Um ITypeDescriptorContext que fornece um contexto de formato.An ITypeDescriptorContext that provides a format context.
Retornos
Um Object que representa o texto convertido.An Object that represents the converted text.
Exceções
A conversão não pode ser executada.The conversion cannot be performed.
Comentários
Uma exceção será gerada se a cadeia de caracteres não puder ser convertida no objeto apropriado.An exception is raised if the string cannot be converted into the appropriate object. A implementação padrão sempre retorna null.The default implementation always returns null.
Use o context parâmetro para extrair informações adicionais sobre o ambiente do qual esse conversor é invocado.Use the context parameter to extract additional information about the environment from which this converter is invoked. Esse parâmetro pode ser null , portanto, sempre verifique.This parameter can be null, so always check it. Além disso, as propriedades no objeto de contexto podem retornar null.Also, properties on the context object can return null.