Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​ComponentModel.​NullableConverter
Assembly: System.ComponentModel.TypeConverter
Inheritance: object → TypeConverter → NullableConverter
Provides automatic conversion between a nullable type and its underlying primitive type.
Properties
public
Type
NullableType
Gets the nullable type.
public
Type
UnderlyingType
Gets the underlying type.
public
TypeConverter
UnderlyingTypeConverter
Gets the underlying type converter.
Methods
public
bool
CanConvertFrom​(ITypeDescriptorContext? context,
Type sourceType)
Returns whether this converter can convert an object of the given type to the type of this converter, using the specified context.
Returns <see langword="true" /> if this converter can perform the conversion; otherwise, <see langword="false" /> .
context
An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
sourceType
A <see cref="T:System.Type" /> that represents the type you want to convert from.
public
bool
CanConvertTo​(ITypeDescriptorContext context,
Type destinationType)
Returns whether this converter can convert the object to the specified type, using the specified context.
Returns <see langword="true" /> if this converter can perform the conversion; otherwise, <see langword="false" /> .
context
An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
destinationType
A <see cref="T:System.Type" /> that represents the type you want to convert to.
public
object
ConvertFrom​(ITypeDescriptorContext context,
Globalization.​CultureInfo culture,
object value)
Converts the given object to the type of this converter, using the specified context and culture information.
Returns An <see cref="T:System.Object" /> that represents the converted value.
context
An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
culture
The <see cref="T:System.Globalization.CultureInfo" /> to use as the current culture.
value
The <see cref="T:System.Object" /> to convert.
public
object
ConvertTo​(ITypeDescriptorContext context,
Globalization.​CultureInfo culture,
object value,
Type destinationType)
Converts the given value object to the specified type, using the specified context and culture information.
Returns An <see cref="T:System.Object" /> that represents the converted value.
context
An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
culture
The <see cref="T:System.Globalization.CultureInfo" /> to use as the current culture.
value
The <see cref="T:System.Object" /> to convert.
destinationType
The <see cref="T:System.Type" /> to convert the value parameter to.
public
object
CreateInstance​(ITypeDescriptorContext context,
Collections.​IDictionary propertyValues)
Creates an instance of the type that this <see cref="T:System.ComponentModel.TypeConverter" /> is associated with, using the specified context, given a set of property values for the object.
Returns An <see cref="T:System.Object" /> representing the given <see cref="T:System.Collections.IDictionary" /> , or <see langword="null" /> if the object cannot be created. This method always returns <see langword="null" /> .
context
An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
propertyValues
An <see cref="T:System.Collections.IDictionary" /> of new property values.
public
bool
GetCreateInstanceSupported​(ITypeDescriptorContext context)
Returns whether changing a value on this object requires a call to <see cref="M:System.ComponentModel.TypeConverter.CreateInstance(System.Collections.IDictionary)" /> to create a new value, using the specified context.
Returns <see langword="true" /> if changing a property on this object requires a call to <see cref="M:System.ComponentModel.TypeConverter.CreateInstance(System.Collections.IDictionary)" /> to create a new value; otherwise, <see langword="false" /> .
context
An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
public
PropertyDescriptorCollection
GetProperties​(ITypeDescriptorContext context,
object value,
Attribute[] attributes)
Returns a collection of properties for the type of array specified by the value parameter, using the specified context and attributes.
Returns A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> with the properties that are exposed for this data type, or <see langword="null" /> if there are no properties.
context
An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
value
An <see cref="T:System.Object" /> that specifies the type of array for which to get properties.
attributes
An array of type <see cref="T:System.Attribute" /> that is used as a filter.
public
bool
GetPropertiesSupported​(ITypeDescriptorContext context)
Returns whether this object supports properties, using the specified context.
Returns <see langword="true" /> if <see cref="M:System.ComponentModel.TypeConverter.GetProperties(System.Object)" /> should be called to find the properties of this object; otherwise, <see langword="false" /> .
context
An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
public
StandardValuesCollection
GetStandardValues​(ITypeDescriptorContext context)
Returns a collection of standard values for the data type this type converter is designed for when provided with a format context.
Returns A <see cref="T:System.ComponentModel.TypeConverter.StandardValuesCollection" /> that holds a standard set of valid values, or <see langword="null" /> if the data type does not support a standard set of values.
context
An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context that can be used to extract additional information about the environment from which this converter is invoked. This parameter or properties of this parameter can be <see langword="null" /> .
public
bool
GetStandardValuesExclusive​(ITypeDescriptorContext context)
Returns whether the collection of standard values returned from <see cref="Overload:System.ComponentModel.TypeConverter.GetStandardValues" /> is an exclusive list of possible values, using the specified context.
Returns <see langword="true" /> if the <see cref="T:System.ComponentModel.TypeConverter.StandardValuesCollection" /> returned from <see cref="M:System.ComponentModel.TypeConverter.GetStandardValues" /> is an exhaustive list of possible values; <see langword="false" /> if other values are possible.
context
An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
public
bool
GetStandardValuesSupported​(ITypeDescriptorContext context)
Returns whether this object supports a standard set of values that can be picked from a list, using the specified context.
Returns <see langword="true" /> if <see cref="M:System.ComponentModel.TypeConverter.GetStandardValues" /> should be called to find a common set of values the object supports; otherwise, <see langword="false" /> .
context
An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
public
bool
IsValid​(ITypeDescriptorContext context,
object value)
Returns whether the given value object is valid for this type and for the specified context.
Returns <see langword="true" /> if the specified value is valid for this object; otherwise, <see langword="false" /> .
context
An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
value
The <see cref="T:System.Object" /> to test for validity.
public
bool
CanConvertFrom​(Type sourceType)
Inherited from TypeConverter
Returns whether this converter can convert an object of the given type to the type of this converter.
Returns <see langword="true" /> if this converter can perform the conversion; otherwise, <see langword="false" /> .
sourceType
A <see cref="T:System.Type" /> that represents the type you want to convert from.
public
bool
CanConvertTo​(Type destinationType)
Inherited from TypeConverter
Returns whether this converter can convert the object to the specified type.
Returns <see langword="true" /> if this converter can perform the conversion; otherwise, <see langword="false" /> .
destinationType
A <see cref="T:System.Type" /> that represents the type you want to convert to.
public
object
ConvertFrom​(object value)
Inherited from TypeConverter
Converts the given value to the type of this converter.
Returns An <see cref="T:System.Object" /> that represents the converted value.
value
The <see cref="T:System.Object" /> to convert.
public
object
ConvertFromInvariantString​(ITypeDescriptorContext context,
string text)
Inherited from TypeConverter
Converts the given string to the type of this converter, using the invariant culture and the specified context.
Returns An <see cref="T:System.Object" /> that represents the converted text.
context
An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
text
The <see cref="T:System.String" /> to convert.
public
object
ConvertFromInvariantString​(string text)
Inherited from TypeConverter
Converts the given string to the type of this converter, using the invariant culture.
Returns An <see cref="T:System.Object" /> that represents the converted text.
text
The <see cref="T:System.String" /> to convert.
public
object
ConvertFromString​(ITypeDescriptorContext context,
Globalization.​CultureInfo culture,
string text)
Inherited from TypeConverter
Converts the given text to an object, using the specified context and culture information.
Returns An <see cref="T:System.Object" /> that represents the converted text.
context
An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
culture
A <see cref="T:System.Globalization.CultureInfo" /> . If <see langword="null" /> is passed, the current culture is assumed.
text
The <see cref="T:System.String" /> to convert.
public
object
ConvertFromString​(ITypeDescriptorContext context,
string text)
Inherited from TypeConverter
Converts the given text to an object, using the specified context.
Returns An <see cref="T:System.Object" /> that represents the converted text.
context
An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
text
The <see cref="T:System.String" /> to convert.
public
object
ConvertFromString​(string text)
Inherited from TypeConverter
Converts the specified text to an object.
Returns An <see cref="T:System.Object" /> that represents the converted text.
text
The text representation of the object to convert.
public
object
ConvertTo​(object value,
Type destinationType)
Inherited from TypeConverter
Converts the given value object to the specified type, using the arguments.
Returns An <see cref="T:System.Object" /> that represents the converted value.
value
The <see cref="T:System.Object" /> to convert.
destinationType
The <see cref="T:System.Type" /> to convert the <paramref name="value" /> parameter to.
public
string
ConvertToInvariantString​(ITypeDescriptorContext context,
object value)
Inherited from TypeConverter
Converts the specified value to a culture-invariant string representation, using the specified context.
Returns A <see cref="T:System.String" /> that represents the converted value.
context
An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
value
The <see cref="T:System.Object" /> to convert.
public
string
ConvertToInvariantString​(object value)
Inherited from TypeConverter
Converts the specified value to a culture-invariant string representation.
Returns A <see cref="T:System.String" /> that represents the converted value.
value
The <see cref="T:System.Object" /> to convert.
public
string
ConvertToString​(ITypeDescriptorContext context,
Globalization.​CultureInfo culture,
object value)
Inherited from TypeConverter
Converts the given value to a string representation, using the specified context and culture information.
Returns An <see cref="T:System.Object" /> that represents the converted value.
context
An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
culture
A <see cref="T:System.Globalization.CultureInfo" /> . If <see langword="null" /> is passed, the current culture is assumed.
value
The <see cref="T:System.Object" /> to convert.
public
string
ConvertToString​(ITypeDescriptorContext context,
object value)
Inherited from TypeConverter
Converts the given value to a string representation, using the given context.
Returns An <see cref="T:System.Object" /> that represents the converted value.
context
An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
value
The <see cref="T:System.Object" /> to convert.
public
string
ConvertToString​(object value)
Inherited from TypeConverter
Converts the specified value to a string representation.
Returns An <see cref="T:System.Object" /> that represents the converted value.
value
The <see cref="T:System.Object" /> to convert.
public
object
CreateInstance​(Collections.​IDictionary propertyValues)
Inherited from TypeConverter
Re-creates an <see cref="T:System.Object" /> given a set of property values for the object.
Returns An <see cref="T:System.Object" /> representing the given <see cref="T:System.Collections.IDictionary" /> , or <see langword="null" /> if the object cannot be created. This method always returns <see langword="null" /> .
propertyValues
An <see cref="T:System.Collections.IDictionary" /> that represents a dictionary of new property values.
protected
Exception
GetConvertFromException​(object value)
Inherited from TypeConverter
Returns an exception to throw when a conversion cannot be performed.
Returns An <see cref="T:System.Exception" /> that represents the exception to throw when a conversion cannot be performed.
value
The <see cref="T:System.Object" /> to convert, or <see langword="null" /> if the object is not available.
protected
Exception
GetConvertToException​(object value,
Type destinationType)
Inherited from TypeConverter
Returns an exception to throw when a conversion cannot be performed.
Returns An <see cref="T:System.Exception" /> that represents the exception to throw when a conversion cannot be performed.
value
The <see cref="T:System.Object" /> to convert, or <see langword="null" /> if the object is not available.
destinationType
A <see cref="T:System.Type" /> that represents the type the conversion was trying to convert to.
public
bool
GetCreateInstanceSupported​()
Inherited from TypeConverter
Returns whether changing a value on this object requires a call to the <see cref="M:System.ComponentModel.TypeConverter.CreateInstance(System.Collections.IDictionary)" /> method to create a new value.
Returns <see langword="true" /> if changing a property on this object requires a call to <see cref="M:System.ComponentModel.TypeConverter.CreateInstance(System.Collections.IDictionary)" /> to create a new value; otherwise, <see langword="false" /> .
public
PropertyDescriptorCollection
GetProperties​(ITypeDescriptorContext context,
object value)
Inherited from TypeConverter
Returns a collection of properties for the type of array specified by the value parameter, using the specified context.
Returns A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> with the properties that are exposed for this data type, or <see langword="null" /> if there are no properties.
context
An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
value
An <see cref="T:System.Object" /> that specifies the type of array for which to get properties.
public
PropertyDescriptorCollection
GetProperties​(object value)
Inherited from TypeConverter
Returns a collection of properties for the type of array specified by the value parameter.
Returns A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> with the properties that are exposed for this data type, or <see langword="null" /> if there are no properties.
value
An <see cref="T:System.Object" /> that specifies the type of array for which to get properties.
public
bool
GetPropertiesSupported​()
Inherited from TypeConverter
Returns whether this object supports properties.
Returns <see langword="true" /> if <see cref="M:System.ComponentModel.TypeConverter.GetProperties(System.Object)" /> should be called to find the properties of this object; otherwise, <see langword="false" /> .
GetStandardValues​()
Inherited from TypeConverter
Returns a collection of standard values from the default context for the data type this type converter is designed for.
Returns A <see cref="T:System.ComponentModel.TypeConverter.StandardValuesCollection" /> containing a standard set of valid values, or <see langword="null" /> if the data type does not support a standard set of values.
public
bool
GetStandardValuesExclusive​()
Inherited from TypeConverter
Returns whether the collection of standard values returned from <see cref="M:System.ComponentModel.TypeConverter.GetStandardValues" /> is an exclusive list.
Returns <see langword="true" /> if the <see cref="T:System.ComponentModel.TypeConverter.StandardValuesCollection" /> returned from <see cref="M:System.ComponentModel.TypeConverter.GetStandardValues" /> is an exhaustive list of possible values; <see langword="false" /> if other values are possible.
public
bool
GetStandardValuesSupported​()
Inherited from TypeConverter
Returns whether this object supports a standard set of values that can be picked from a list.
Returns <see langword="true" /> if <see cref="M:System.ComponentModel.TypeConverter.GetStandardValues" /> should be called to find a common set of values the object supports; otherwise, <see langword="false" /> .
public
bool
IsValid​(object value)
Inherited from TypeConverter
Returns whether the given value object is valid for this type.
Returns <see langword="true" /> if the specified value is valid for this object; otherwise, <see langword="false" /> .
value
The object to test for validity.
protected
PropertyDescriptorCollection
SortProperties​(PropertyDescriptorCollection props,
string[] names)
Inherited from TypeConverter
Sorts a collection of properties.
Returns A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> that contains the sorted properties.
props
A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> that has the properties to sort.
names
An array of names in the order you want the properties to appear in the collection.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object