105 references to CanConvertFrom
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)
2044if (typeConverter == null || !typeConverter.CanConvertFrom(typeof(string)))
Microsoft.AspNetCore.Http.Abstractions.Tests (3)
PathStringTests.cs (3)
296Assert.True(converter.CanConvertFrom(typeof(string))); 297Assert.False(converter.CanConvertFrom(typeof(int))); 298Assert.False(converter.CanConvertFrom(typeof(bool)));
Microsoft.AspNetCore.Mvc.Abstractions (1)
ModelBinding\ModelMetadata.cs (1)
777IsConvertibleType = TypeDescriptor.GetConverter(ModelType).CanConvertFrom(typeof(string));
Microsoft.AspNetCore.Mvc.Core (1)
ModelBinding\ModelBindingHelper.cs (1)
693var canConvertFrom = converter.CanConvertFrom(value.GetType());
Microsoft.Extensions.Configuration.Binder (1)
ConfigurationBinder.cs (1)
953if (converter.CanConvertFrom(typeof(string)))
Microsoft.Maui.Controls (2)
BindableProperty.cs (1)
227 if (KnownTypeConverters.TryGetValue(returnType, out TypeConverter typeConverterTo) && typeConverterTo.CanConvertFrom(valueType))
TypeConversionHelper.cs (1)
59 if (TryGetTypeConverter(targetType, out converter) && converter is not null && converter.CanConvertFrom(valueType))
PresentationCore.Tests (10)
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[]))),
System\Windows\DurationConverter.Tests.cs (1)
22Assert.Equal(expected, converter.CanConvertFrom(sourceType));
System\Windows\Input\Command\KeyGestureConverter.Tests.cs (1)
25Assert.Equal(expected, converter.CanConvertFrom(sourceType));
System\Windows\Input\Command\MouseGestureConverter.Tests.cs (1)
25Assert.Equal(expected, converter.CanConvertFrom(sourceType));
System\Windows\TextDecorationCollectionConverter.Tests.cs (1)
22Assert.Equal(expected, converter.CanConvertFrom(sourceType));
TestUtilities\BinaryFormatTestExtensions.cs (2)
60return !((converter.CanConvertFrom(typeof(string)) && converter.CanConvertTo(typeof(string))) 61|| (converter.CanConvertFrom(typeof(byte[])) && converter.CanConvertTo(typeof(byte[]))));
PresentationFramework (7)
MS\Internal\Data\DefaultValueConverter.cs (2)
151canConvertFrom = (typeConverter != null) ? typeConverter.CanConvertFrom(targetType) : false; 163canConvertFrom = (typeConverter != null) ? typeConverter.CanConvertFrom(sourceType) : false;
MS\Internal\Data\PropertyPathWorker.cs (1)
1383if (tc != null && tc.CanConvertFrom(typeof(string)))
System\Windows\Data\BindingExpressionBase.cs (1)
2186if (converter != null && converter.CanConvertFrom(value.GetType()))
System\Windows\PropertyPath.cs (1)
785if (tc != null && tc.CanConvertFrom(typeof(string)))
System\Windows\PropertyPathConverter.cs (1)
265if (converter.CanConvertTo(typeof(string)) && converter.CanConvertFrom(typeof(string)))
System\Windows\StyleHelper.cs (1)
5903if (typeConverter != null && typeConverter.CanConvertFrom(typeof(String)))
System.Configuration.ConfigurationManager (5)
System\Configuration\ApplicationSettingsBase.cs (1)
519if (tc.CanConvertTo(typeof(string)) && tc.CanConvertFrom(typeof(string)))
System\Configuration\ConfigurationProperty.cs (2)
280if (!Converter.CanConvertFrom(value.GetType())) 401!_converter.CanConvertFrom(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.Data.Common (2)
System\Data\XMLSchema.cs (2)
50if (converter.CanConvertFrom(typeof(string))) 297if (converter.CanConvertFrom(typeof(string)))
System.Drawing.Common.Tests (7)
System\Drawing\IconConverterTests.cs (2)
37Assert.True(_icoConv.CanConvertFrom(typeof(byte[])), "byte[] (no context)"); 50Assert.True(_icoConvFrmTD.CanConvertFrom(typeof(byte[])), "TD byte[] (no context)");
System\Drawing\ImageConverterTests.cs (3)
61Assert.True(_imgConv.CanConvertFrom(typeof(byte[])), "byte[] (no context)"); 64Assert.True(_imgConv.CanConvertFrom(typeof(Icon)), "Icon (no context)"); 76Assert.True(_imgConvFrmTD.CanConvertFrom(typeof(byte[])), "TD byte[] (no context)");
System\Drawing\ImageFormatConverterTests.cs (2)
29Assert.True(_imgFmtConv.CanConvertFrom(typeof(string)), "string (no context)"); 36Assert.True(_imgFmtConvFrmTD.CanConvertFrom(typeof(string)), "TD string (no context)");
System.Windows.Forms (19)
System\Resources\ResXDataNode.cs (4)
252if (converter.CanConvertTo(typeof(string)) && converter.CanConvertFrom(typeof(string))) 266if (converter.CanConvertTo(typeof(byte[])) && converter.CanConvertFrom(typeof(byte[]))) 364if (!converter.CanConvertFrom(typeof(string))) 404&& converter.CanConvertFrom(typeof(byte[]))
System\Windows\Forms\ActiveX\Control.ActiveXImpl.cs (6)
980if ((converter.CanConvertTo(typeof(string)) && converter.CanConvertFrom(typeof(string))) 981|| (converter.CanConvertTo(typeof(byte[])) && converter.CanConvertFrom(typeof(byte)))) 1177if (converter.CanConvertFrom(typeof(string))) 1181else if (converter.CanConvertFrom(typeof(byte[]))) 1555if (converter.CanConvertFrom(typeof(string))) 1559else if (converter.CanConvertFrom(typeof(byte[])))
System\Windows\Forms\Controls\DataGridView\DataGridView.DataConnection.cs (3)
917else if (typeof(Image).IsAssignableFrom(type) || imageTypeConverter.CanConvertFrom(type)) 944if (!imageTypeConverter.CanConvertFrom(_props[i].PropertyType)) 1475if (boundColumnConverter is not null && boundColumnConverter.CanConvertFrom(valueType))
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\MergePropertyDescriptor.cs (1)
159if (converter.CanConvertTo(typeof(string)) && converter.CanConvertFrom(typeof(string)))
System\Windows\Forms\Internal\Formatter.cs (5)
167if (targetConverter is not null && targetConverter != targetTypeTypeConverter && targetConverter.CanConvertFrom(sourceType)) 212else if (targetConverter is not null && targetConverter.CanConvertFrom(sourceType)) 299if (targetConverter is not null && targetTypeTypeConverter != targetConverter && targetConverter.CanConvertFrom(sourceType)) 334if (targetConverter is not null && targetConverter.CanConvertFrom(s_booleanType)) 357if (targetConverter is not null && targetConverter.CanConvertFrom(sourceType))
System.Windows.Forms.Design (6)
System\Windows\Forms\Design\DataGridViewAddColumnDialog.cs (2)
732if (!imageTypeConverter.CanConvertFrom(propertyDescriptor.PropertyType)) 823else if (typeof(Image).IsAssignableFrom(type) || imageTypeConverter.CanConvertFrom(type))
System\Windows\Forms\Design\DataGridViewDesigner.cs (4)
435if (!imageTypeConverter.CanConvertFrom(dataFieldProperty.PropertyType)) 496if (!imageTypeConverter.CanConvertFrom(dataFieldProperty.PropertyType)) 634if (imageTypeConverter.CanConvertFrom(propType)) 647else if (typeof(Image).IsAssignableFrom(propType) || imageTypeConverter.CanConvertFrom(propType))
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 (11)
System\Windows\Forms\ColumnHeaderConverterTests.cs (1)
21Assert.Equal(expected, converter.CanConvertFrom(sourceType));
System\Windows\Forms\CursorConverterTests.cs (1)
21Assert.Equal(expected, converter.CanConvertFrom(sourceType));
System\Windows\Forms\Layout\TableLayoutSettingsTypeConverterTests.cs (1)
24Assert.Equal(expected, converter.CanConvertFrom(sourceType));
System\Windows\Forms\LinkAreaConverterTests.cs (1)
21Assert.Equal(expected, converter.CanConvertFrom(sourceType));
System\Windows\Forms\LinkConverterTests.cs (1)
19Assert.Equal(expected, converter.CanConvertFrom(sourceType));
System\Windows\Forms\ListViewGroupConverterTests.cs (1)
23Assert.Equal(expected, converter.CanConvertFrom(sourceType));
System\Windows\Forms\ListViewItemConverterTests.cs (1)
23Assert.Equal(expected, converter.CanConvertFrom(sourceType));
System\Windows\Forms\ListViewSubItemConverterTests.cs (1)
23Assert.Equal(expected, converter.CanConvertFrom(sourceType));
System\Windows\Forms\OpacityConverterTests.cs (1)
20Assert.Equal(expected, converter.CanConvertFrom(sourceType));
System\Windows\Forms\PaddingConverterTests.cs (1)
22Assert.Equal(expected, converter.CanConvertFrom(sourceType));
System\Windows\Forms\TableLayoutPanelCellPositionTests.cs (1)
107Assert.Equal(expected, converter.CanConvertFrom(sourceType));
System.Xaml (5)
System\Windows\Markup\ValueSerializer.cs (2)
141else if (converter.CanConvertTo(typeof(string)) && converter.CanConvertFrom(typeof(string)) && 177if (converter is not null && converter.CanConvertTo(typeof(string)) && converter.CanConvertFrom(typeof(string)) &&
System\Xaml\Runtime\ClrObjectRuntime.cs (1)
669if (typeConverter.CanConvertFrom(value.GetType()))
System\Xaml\Schema\BuiltInValueConverter.cs (2)
199!stdConverter.CanConvertFrom(typeof(string)) || !stdConverter.CanConvertFrom(typeof(Uri)) ||
System.Xaml.Tests (9)
System\Windows\Markup\NameReferenceConverterTests.cs (1)
23Assert.Equal(expected, converter.CanConvertFrom(type!));
System\Xaml\Replacements\DateTimeConverter2Tests.cs (1)
24Assert.Equal(expected, converter.CanConvertFrom(sourceType!));
System\Xaml\Replacements\DateTimeOffsetConverter2Tests.cs (1)
26Assert.Equal(expected, converter.CanConvertFrom(sourceType!));
System\Xaml\Replacements\EventConverterTests.cs (1)
23Assert.Equal(expected, converter.CanConvertFrom(sourceType!));
System\Xaml\Replacements\TypeListConverterTests.cs (1)
22Assert.Equal(expected, converter.CanConvertFrom(sourceType!));
System\Xaml\Replacements\TypeTypeConverterTests.cs (1)
24Assert.Equal(expected, converter.CanConvertFrom(sourceType!));
System\Xaml\Replacements\TypeUriConverterTests.cs (2)
53Assert.Equal(expected, converter.CanConvertFrom(sourceType)); 60Assert.Throws<ArgumentNullException>("sourceType", () => converter.CanConvertFrom(null!));
System\Xaml\Schema\XamlTypeTypeConverterTests.cs (1)
22Assert.Equal(expected, converter.CanConvertFrom(sourceType!));
WindowsBase.Tests (9)
System\Windows\ExpressionConverterTests.cs (1)
87Assert.False(converter.CanConvertFrom(sourceType!));
System\Windows\Input\KeyConverterTests.cs (1)
237Assert.Equal(expected, converter.CanConvertFrom(sourceType!));
System\Windows\Input\ModifierKeysConverterTests.cs (1)
203Assert.Equal(expected, converter.CanConvertFrom(sourceType!));
System\Windows\Int32RectConverterTests.cs (1)
113Assert.Equal(expected, converter.CanConvertFrom(sourceType!));
System\Windows\Media\MatrixConverterTests.cs (1)
113Assert.Equal(expected, converter.CanConvertFrom(sourceType!));
System\Windows\PointConverterTests.cs (1)
113Assert.Equal(expected, converter.CanConvertFrom(sourceType!));
System\Windows\RectConverterTests.cs (1)
113Assert.Equal(expected, converter.CanConvertFrom(sourceType!));
System\Windows\SizeConverterTests.cs (1)
113Assert.Equal(expected, converter.CanConvertFrom(sourceType!));
System\Windows\VectorConverterTests.cs (1)
113Assert.Equal(expected, converter.CanConvertFrom(sourceType!));