TypeConverter.CanConvertTo Metodo
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Indica se questo convertitore può convertire l'oggetto nel tipo specificato.
CanConvertTo(Type) |
Indica se questo convertitore può convertire l'oggetto nel tipo specificato. |
CanConvertTo(ITypeDescriptorContext, Type) |
Restituisce un valore che indica se il convertitore può convertire l'oggetto nel tipo specificato usando il contesto specificato. |
- Origine:
- TypeConverter.cs
- Origine:
- TypeConverter.cs
- Origine:
- TypeConverter.cs
Indica se questo convertitore può convertire l'oggetto nel tipo specificato.
public:
bool CanConvertTo(Type ^ destinationType);
public bool CanConvertTo (Type destinationType);
public bool CanConvertTo (Type? destinationType);
member this.CanConvertTo : Type -> bool
Public Function CanConvertTo (destinationType As Type) As Boolean
Parametri
Restituisce
true
se il convertitore può eseguire la conversione. In caso contrario, false
.
Commenti
Se destinationType
è una stringa, l'implementazione predefinita di CanConvertTo restituisce true
sempre .
Si applica a
.NET 9 e altre versioni
Prodotto | Versioni |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
- Origine:
- TypeConverter.cs
- Origine:
- TypeConverter.cs
- Origine:
- TypeConverter.cs
Restituisce un valore che indica se il convertitore può convertire l'oggetto nel tipo specificato usando il contesto specificato.
public:
virtual bool CanConvertTo(System::ComponentModel::ITypeDescriptorContext ^ context, Type ^ destinationType);
public virtual bool CanConvertTo (System.ComponentModel.ITypeDescriptorContext context, Type destinationType);
public virtual bool CanConvertTo (System.ComponentModel.ITypeDescriptorContext? context, Type? destinationType);
abstract member CanConvertTo : System.ComponentModel.ITypeDescriptorContext * Type -> bool
override this.CanConvertTo : System.ComponentModel.ITypeDescriptorContext * Type -> bool
Public Overridable Function CanConvertTo (context As ITypeDescriptorContext, destinationType As Type) As Boolean
Parametri
- context
- ITypeDescriptorContext
Oggetto ITypeDescriptorContext che fornisce un contesto di formato.
Restituisce
true
se il convertitore può eseguire la conversione. In caso contrario, false
.
Commenti
Utilizzare il parametro context
per estrarre ulteriori informazioni sull'ambiente dal quale viene richiamato il convertitore. Questo parametro può essere null
, quindi controllarlo sempre. Anche le proprietà dell'oggetto di contesto possono restituire null
.
Se destinationType
è una stringa, l'implementazione predefinita di CanConvertTo restituisce true
sempre .
Note per gli eredi
Eseguire l'override del metodo per fornire specifici requisiti di conversione.
Vedi anche
Si applica a
.NET 9 e altre versioni
Prodotto | Versioni |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
Feedback su .NET
.NET è un progetto open source. Seleziona un collegamento per fornire feedback: