85 references to CanConvertTo
BinaryFormatTests (4)
FormatTests\FormattedObject\BinaryFormattedTypes.cs (4)
24converter.CanConvertFrom(typeof(string)) && converter.CanConvertTo(typeof(string)), 27converter.CanConvertFrom(typeof(byte[])) && converter.CanConvertTo(typeof(byte[])), 46(converter.CanConvertFrom(typeof(string)) && converter.CanConvertTo(typeof(string))) 47|| (converter.CanConvertFrom(typeof(byte[])) && converter.CanConvertTo(typeof(byte[]))),
Microsoft.AspNetCore.Components (1)
BindConverter.cs (1)
1837if (typeConverter == null || !typeConverter.CanConvertTo(typeof(string)))
Microsoft.AspNetCore.Http.Abstractions.Tests (3)
PathStringTests.cs (3)
299Assert.True(converter.CanConvertTo(typeof(string))); 300Assert.False(converter.CanConvertTo(typeof(int))); 301Assert.False(converter.CanConvertTo(typeof(bool)));
Microsoft.AspNetCore.Mvc.Core (1)
ModelBinding\ModelBindingHelper.cs (1)
698if (!(canConvertFrom || converter.CanConvertTo(destinationType)))
Microsoft.Maui.Controls (1)
TypeConversionHelper.cs (1)
53 if (TryGetTypeConverter(valueType, out var converter) && converter is not null && converter.CanConvertTo(targetType))
PresentationBuildTasks (2)
MS\Internal\MarkupCompiler\MarkupCompiler.cs (2)
1653if (converter.CanConvertTo(typeof(string))) 1721if (converter.CanConvertTo(typeof(string)))
PresentationCore.Tests (6)
BinaryFormat\BinaryFormattedTypes.cs (4)
25converter.CanConvertFrom(typeof(string)) && converter.CanConvertTo(typeof(string)), 28converter.CanConvertFrom(typeof(byte[])) && converter.CanConvertTo(typeof(byte[])), 47(converter.CanConvertFrom(typeof(string)) && converter.CanConvertTo(typeof(string))) 48|| (converter.CanConvertFrom(typeof(byte[])) && converter.CanConvertTo(typeof(byte[]))),
TestUtilities\BinaryFormatTestExtensions.cs (2)
60return !((converter.CanConvertFrom(typeof(string)) && converter.CanConvertTo(typeof(string))) 61|| (converter.CanConvertFrom(typeof(byte[])) && converter.CanConvertTo(typeof(byte[]))));
PresentationFramework (8)
MS\Internal\Data\DefaultValueConverter.cs (2)
150canConvertTo = (typeConverter != null) ? typeConverter.CanConvertTo(targetType) : false; 162canConvertTo = (typeConverter != null) ? typeConverter.CanConvertTo(sourceType) : false;
System\Windows\Controls\ContentPresenter.cs (3)
1005Debug.Assert(tc.CanConvertTo(typeof(UIElement))); 1114Debug.Assert(!(tc != null && tc.CanConvertTo(typeof(UIElement)))); // this is handled by a different template 1176tc.CanConvertTo(typeof(UIElement)))
System\Windows\Documents\TextRangeSerialization.cs (1)
1128Invariant.Assert(typeConverter.CanConvertTo(typeof(string)), "type is expected to be convertable into string type");
System\Windows\Markup\Primitives\ElementMarkupObject.cs (1)
806converter.CanConvertTo(typeof(MarkupExtension)))
System\Windows\PropertyPathConverter.cs (1)
268if (converter.CanConvertTo(typeof(string)) && converter.CanConvertFrom(typeof(string)))
System.Configuration.ConfigurationManager (4)
System\Configuration\ApplicationSettingsBase.cs (1)
519if (tc.CanConvertTo(typeof(string)) && tc.CanConvertFrom(typeof(string)))
System\Configuration\ConfigurationProperty.cs (1)
402!_converter.CanConvertTo(typeof(string)))
System\Configuration\SettingsPropertyValue.cs (2)
209if (converter != null && converter.CanConvertTo(typeof(string)) && converter.CanConvertFrom(typeof(string))) 262if (converter != null && converter.CanConvertTo(typeof(string)) && converter.CanConvertFrom(typeof(string)))
System.Drawing.Common.Tests (14)
System\Drawing\IconConverterTests.cs (8)
67Assert.True(_icoConv.CanConvertTo(typeof(string)), "string (no context)"); 70Assert.True(_icoConv.CanConvertTo(typeof(byte[])), "byte[] (no context)"); 73Assert.True(_icoConv.CanConvertTo(typeof(Image)), "Image (no context)"); 75Assert.True(_icoConv.CanConvertTo(typeof(Bitmap)), "Bitmap (no context)"); 85Assert.True(_icoConvFrmTD.CanConvertTo(typeof(string)), "TD string (no context)"); 88Assert.True(_icoConvFrmTD.CanConvertTo(typeof(byte[])), "TD byte[] (no context)"); 91Assert.True(_icoConvFrmTD.CanConvertTo(typeof(Image)), "TD Image (no context)"); 93Assert.True(_icoConvFrmTD.CanConvertTo(typeof(Bitmap)), "TD Bitmap (no context)");
System\Drawing\ImageConverterTests.cs (4)
93Assert.True(_imgConv.CanConvertTo(typeof(string)), "stirng (no context)"); 96Assert.True(_imgConv.CanConvertTo(typeof(byte[])), "byte[] (no context)"); 107Assert.True(_imgConvFrmTD.CanConvertTo(typeof(string)), "TD string (no context)"); 110Assert.True(_imgConvFrmTD.CanConvertTo(typeof(byte[])), "TD byte[] (no context)");
System\Drawing\ImageFormatConverterTests.cs (2)
47Assert.True(_imgFmtConv.CanConvertTo(typeof(string)), "string (no context)"); 54Assert.True(_imgFmtConvFrmTD.CanConvertTo(typeof(string)), "TD string (no context)");
System.Windows.Forms (16)
System\Resources\ResXDataNode.cs (2)
251if (converter.CanConvertTo(typeof(string)) && converter.CanConvertFrom(typeof(string))) 265if (converter.CanConvertTo(typeof(byte[])) && converter.CanConvertFrom(typeof(byte[])))
System\Windows\Forms\ActiveX\Control.ActiveXImpl.cs (2)
979if ((converter.CanConvertTo(typeof(string)) && converter.CanConvertFrom(typeof(string))) 980|| (converter.CanConvertTo(typeof(byte[])) && converter.CanConvertFrom(typeof(byte))))
System\Windows\Forms\Controls\DataGridView\DataGridView.DataConnection.cs (1)
1482if (valueConverter is not null && valueConverter.CanConvertTo(columnType))
System\Windows\Forms\Controls\DataGridView\DataGridViewCell.DataGridViewCellAccessibleObject.cs (1)
204if (converter is not null && converter.CanConvertTo(typeof(string)))
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\MergePropertyDescriptor.cs (2)
139if (converter.CanConvertTo(typeof(InstanceDescriptor))) 159if (converter.CanConvertTo(typeof(string)) && converter.CanConvertFrom(typeof(string)))
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyDescriptorGridEntry.cs (1)
786if (handler is null && value is not null && TypeConverter is not null && TypeConverter.CanConvertTo(typeof(string)))
System\Windows\Forms\DataBinding\Binding.cs (2)
722if (typeConverter is not null && typeConverter.CanConvertTo(type)) 796if (typeConverter is not null && typeConverter.CanConvertTo(type))
System\Windows\Forms\Internal\Formatter.cs (5)
150if (sourceConverter is not null && sourceConverter != sourceTypeTypeConverter && sourceConverter.CanConvertTo(targetType)) 181if (sourceConverter is not null && sourceConverter.CanConvertTo(s_booleanType)) 207if (sourceConverter is not null && sourceConverter.CanConvertTo(targetType)) 304if (sourceConverter is not null && sourceTypeTypeConverter != sourceConverter && sourceConverter.CanConvertTo(targetType)) 360else if (sourceConverter is not null && sourceConverter.CanConvertTo(targetType))
System.Windows.Forms.Design (3)
System\ComponentModel\Design\Serialization\CodeDomSerializerBase.cs (2)
1889if (converter.CanConvertTo(typeof(InstanceDescriptor))) 1901if (converter.CanConvertTo(typeof(InstanceDescriptor)))
System\ComponentModel\Design\Serialization\EnumCodeDomSerializer.cs (1)
36if (converter is not null && converter.CanConvertTo(typeof(Enum[])))
System.Windows.Forms.Primitives.TestUtilities (2)
System\Windows\Forms\BinaryFormat\BinaryFormatTestExtensions.cs (2)
64return !((converter.CanConvertFrom(typeof(string)) && converter.CanConvertTo(typeof(string))) 65|| (converter.CanConvertFrom(typeof(byte[])) && converter.CanConvertTo(typeof(byte[]))));
System.Windows.Forms.Tests (13)
System\Windows\Forms\ColumnHeaderConverterTests.cs (1)
43Assert.Equal(expected, converter.CanConvertTo(destinationType));
System\Windows\Forms\CursorConverterTests.cs (1)
71Assert.Equal(expected, converter.CanConvertTo(destinationType));
System\Windows\Forms\DataGridViewRowConverterTests.cs (1)
18Assert.True(converter.CanConvertTo(typeof(InstanceDescriptor)));
System\Windows\Forms\Layout\TableLayoutSettingsTypeConverterTests.cs (1)
156Assert.Equal(expected, converter.CanConvertTo(destinationType));
System\Windows\Forms\LinkAreaConverterTests.cs (1)
69Assert.Equal(expected, converter.CanConvertTo(destinationType));
System\Windows\Forms\LinkConverterTests.cs (1)
67Assert.Equal(expected, converter.CanConvertTo(destinationType));
System\Windows\Forms\ListViewGroupConverterTests.cs (1)
136Assert.Equal(expected, converter.CanConvertTo(destinationType));
System\Windows\Forms\ListViewItemConverterTests.cs (1)
45Assert.Equal(expected, converter.CanConvertTo(destinationType));
System\Windows\Forms\ListViewSubItemConverterTests.cs (1)
45Assert.Equal(expected, converter.CanConvertTo(destinationType));
System\Windows\Forms\OpacityConverterTests.cs (1)
79Assert.Equal(expected, converter.CanConvertTo(destinationType));
System\Windows\Forms\PaddingConverterTests.cs (1)
71Assert.Equal(expected, converter.CanConvertTo(destinationType));
System\Windows\Forms\TableLayoutPanelCellPositionTests.cs (1)
168Assert.Equal(expected, converter.CanConvertTo(destinationType));
System\Windows\Forms\TableLayoutStyleTests.cs (1)
121Assert.Equal(expected, converter.CanConvertTo(destinationType));
System.Xaml (5)
System\Windows\Markup\ValueSerializer.cs (2)
143else if (converter.CanConvertTo(typeof(string)) && converter.CanConvertFrom(typeof(string)) && 178if (converter is not null && converter.CanConvertTo(typeof(string)) && converter.CanConvertFrom(typeof(string)) &&
System\Xaml\Schema\BuiltInValueConverter.cs (3)
177!stdConverter.CanConvertTo(typeof(string)) || !stdConverter.CanConvertTo(typeof(Uri)) || !stdConverter.CanConvertTo(typeof(InstanceDescriptor)))
System.Xaml.Tests (2)
System\Windows\Markup\StaticExtensionTests.cs (1)
208Assert.Equal(expected, converter.CanConvertTo(type));
System\Windows\Markup\TypeExtensionTests.cs (1)
169Assert.Equal(expected, converter.CanConvertTo(type));