Chronos Plugins 5.9.0
This documentation covers the plugin interfaces definitions and an example implementation.
Loading...
Searching...
No Matches
MockPlugin.SampleListColumns.MyDateConverter Class Reference

Just like the default converter, but always use the invariant culture and wraps/unwraps the "MyDate". More...

+ Inheritance diagram for MockPlugin.SampleListColumns.MyDateConverter:
+ Collaboration diagram for MockPlugin.SampleListColumns.MyDateConverter:

Public Member Functions

override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 
override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
 
override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
 
override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
 

Private Attributes

readonly TypeConverter mConv = TypeDescriptor.GetConverter(typeof(DateTime))
 

Detailed Description

Just like the default converter, but always use the invariant culture and wraps/unwraps the "MyDate".

Definition at line 79 of file DateColumn.cs.

Member Function Documentation

◆ CanConvertFrom()

override bool MockPlugin.SampleListColumns.MyDateConverter.CanConvertFrom ( ITypeDescriptorContext context,
Type sourceType )

Definition at line 102 of file DateColumn.cs.

103 {
104 return mConv.CanConvertFrom(context, sourceType);
105 }

References MockPlugin.SampleListColumns.MyDateConverter.mConv.

◆ CanConvertTo()

override bool MockPlugin.SampleListColumns.MyDateConverter.CanConvertTo ( ITypeDescriptorContext context,
Type destinationType )

Definition at line 107 of file DateColumn.cs.

108 {
109 return mConv.CanConvertTo(context, destinationType);
110 }

References MockPlugin.SampleListColumns.MyDateConverter.mConv.

◆ ConvertFrom()

override object MockPlugin.SampleListColumns.MyDateConverter.ConvertFrom ( ITypeDescriptorContext context,
CultureInfo culture,
object value )

Definition at line 91 of file DateColumn.cs.

92 {
93 // TypeConverter throws a NotSupportedException if the type is already correct, don't call ConvertFrom then!
94 if (value is DateTime dt)
95 {
96 return new MyDate(dt);
97 }
98 // ReSharper disable once PossibleNullReferenceException
99 return new MyDate((DateTime) mConv.ConvertFrom(context, CultureInfo.InvariantCulture, value));
100 }

References MockPlugin.SampleListColumns.MyDateConverter.mConv.

◆ ConvertTo()

override object MockPlugin.SampleListColumns.MyDateConverter.ConvertTo ( ITypeDescriptorContext context,
CultureInfo culture,
object value,
Type destinationType )

Definition at line 82 of file DateColumn.cs.

83 {
84 if (value is MyDate mdt)
85 {
86 return mConv.ConvertTo(context, CultureInfo.InvariantCulture, mdt.DateTime, destinationType);
87 }
88 return mConv.ConvertTo(context, CultureInfo.InvariantCulture, value, destinationType);
89 }

References MockPlugin.SampleListColumns.MyDateConverter.mConv.

Member Data Documentation

◆ mConv

readonly TypeConverter MockPlugin.SampleListColumns.MyDateConverter.mConv = TypeDescriptor.GetConverter(typeof(DateTime))
private

The documentation for this class was generated from the following file: