126 references to ConvertFrom
Microsoft.AspNetCore.Mvc.Core.Test (4)
ModelBinding\Binders\EnumTypeModelBinderTest.cs (4)
77var expected = enumConverter.ConvertFrom(flagsEnumValue).ToString(); 101var expected = enumConverter.ConvertFrom(flagsEnumValue).ToString(); 163var expected = enumConverter.ConvertFrom(flagsEnumValue).ToString(); 188var expected = enumConverter.ConvertFrom(flagsEnumValue).ToString();
Microsoft.Maui.Controls (1)
TypeConversionHelper.cs (1)
61 convertedValue = converter.ConvertFrom(value) ?? throw new InvalidOperationException($"The {converter.GetType()} returned null when converting from {valueType}");
PresentationFramework (1)
System\Windows\Markup\Baml2006\Baml2006Reader.cs (1)
1526_xamlNodesWriter.WriteValue(converter.ConvertFrom(_binaryReader.ReadBytes(dataByteSize)));
System.ComponentModel.Annotations (1)
System\ComponentModel\DataAnnotations\RangeAttribute.cs (1)
245conversion = value => value.GetType() == type ? value : converter.ConvertFrom(value);
System.Configuration.ConfigurationManager (1)
System\Configuration\ConfigurationProperty.cs (1)
283value = Converter.ConvertFrom(value);
System.Drawing.Common.Tests (19)
System\Drawing\FontConverterTests.cs (9)
20Assert.Equal("Times New Roman", converter.ConvertFrom("Times") as string); 24Assert.Equal("Times", converter.ConvertFrom("Times") as string); 35Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(null)); 36Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(1)); 49Font font = (Font)converter.ConvertFrom(input); 63AssertExtensions.Throws<ArgumentException>(paramName, netfxParamName, () => converter.ConvertFrom(input)); 71Assert.Throws<InvalidEnumArgumentException>(paramName, () => converter.ConvertFrom(input)); 78Font font = (Font)converter.ConvertFrom(string.Empty); 244GraphicsUnit value = (GraphicsUnit)converter.ConvertFrom(input);
System\Drawing\IconConverterTests.cs (2)
112Assert.Throws<NotSupportedException>(() => _icoConv.ConvertFrom("System.Drawing.String")); 124Assert.Throws<NotSupportedException>(() => _icoConvFrmTD.ConvertFrom("System.Drawing.String"));
System\Drawing\ImageConverterTests.cs (4)
39Bitmap IconBitmap = (Bitmap)_imgConv.ConvertFrom(icon); 54object image = converter.ConvertFrom(ms.ToArray()); 139Assert.Throws<NotSupportedException>(() => _imgConv.ConvertFrom("System.Drawing.String")); 146Assert.Throws<NotSupportedException>(() => _imgConvFrmTD.ConvertFrom("System.Drawing.String"));
System\Drawing\ImageFormatConverterTests.cs (4)
118Assert.Throws<FormatException>(() => _imgFmtConv.ConvertFrom("System.Drawing.String")); 120Assert.Throws<FormatException>(() => _imgFmtConv.ConvertFrom("[ImageFormat: abcdefgh-ijkl-mnop-qrst-uvwxyz012345]")); 122Assert.Throws<FormatException>(() => _imgFmtConvFrmTD.ConvertFrom("System.Drawing.String")); 124Assert.Throws<FormatException>(() => _imgFmtConvFrmTD.ConvertFrom("[ImageFormat: abcdefgh-ijkl-mnop-qrst-uvwxyz012345]"));
System.Resources.Extensions (1)
System\Resources\Extensions\DeserializingResourceReader.cs (1)
177value = converter.ConvertFrom(data)!;
System.Windows.Forms (3)
System\Resources\ResXDataNode.cs (2)
406return converter.ConvertFrom(serializedData); 615return TypeDescriptor.GetConverter(typeof(ResXFileRef)).ConvertFrom(_fileRef.ToString());
System\Windows\Forms\Controls\DataGridView\DataGridView.DataConnection.cs (1)
1477value = boundColumnConverter.ConvertFrom(value);
System.Windows.Forms.Design.Tests (3)
System\Resources\Tools\StronglyTypedResourceBuilderTests.cs (3)
639AxHost.State state = Assert.IsType<AxHost.State>(converter.ConvertFrom(resourceByte)); 676using Bitmap resourceBitmap = Assert.IsType<Bitmap>(converter.ConvertFrom(resourceBytes)); 684using Icon resourceIcon = Assert.IsType<Icon>(converter.ConvertFrom(resourceByte));
System.Windows.Forms.Tests (92)
System\Resources\ResxDataNodeTests.cs (2)
36Bitmap result = Assert.IsType<Bitmap>(converter.ConvertFrom(bitmapBytes!)); 51var result = Assert.IsType<Bitmap>(converter.ConvertFrom(bitmapBytes!));
System\Windows\Forms\ColumnHeaderConverterTests.cs (1)
31Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value));
System\Windows\Forms\CursorConverterTests.cs (4)
30Assert.Same(Cursors.AppStarting, converter.ConvertFrom(value)); 38using Cursor cursor = Assert.IsType<Cursor>(converter.ConvertFrom(data)); 52Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value)); 59Assert.Throws<ArgumentException>("stream", () => converter.ConvertFrom(Array.Empty<byte>()));
System\Windows\Forms\KeysConverterTests.cs (1)
22var result = (Keys)converter.ConvertFrom(input);
System\Windows\Forms\Layout\TableLayoutSettingsTests.cs (49)
34TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 170TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 186TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 202TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 221TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 241TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 260TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 276TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 292TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 310TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 327TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 343TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 361TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 377TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 393TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 411TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 427TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 443TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 552TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 578TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 633TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 655TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 671TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 775TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 805TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 853TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 879TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 895TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 912TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 1008TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 1036TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 1084TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 1110TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 1127TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 1148TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 1251TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 1281TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 1329TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 1355TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 1371TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 1388TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 1484TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 1512TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 1560TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 1586TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 1602TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 1623TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 1644TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 1696TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />"));
System\Windows\Forms\Layout\TableLayoutSettingsTypeConverterTests.cs (9)
31TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom( 104TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(value)); 115Assert.Throws<XmlException>(() => converter.ConvertFrom(value)); 125Assert.Throws<ArgumentException>(() => converter.ConvertFrom($@"<?xml version=""1.0"" encoding=""utf-16""?><Root><Columns Styles=""{style}"" /></Root>")); 135Assert.Throws<IndexOutOfRangeException>(() => converter.ConvertFrom($@"<?xml version=""1.0"" encoding=""utf-16""?><Root><Columns Styles=""{style}"" /></Root>")); 144Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value)); 214TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 223TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 249TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />"));
System\Windows\Forms\LinkAreaConverterTests.cs (3)
37Assert.Equal(expected, converter.ConvertFrom(value)); 48Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value)); 57Assert.Throws<ArgumentException>(() => converter.ConvertFrom(value));
System\Windows\Forms\LinkConverterTests.cs (3)
35AssertEqualLink(expected, converter.ConvertFrom(value)); 46Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value)); 55Assert.Throws<ArgumentException>(() => converter.ConvertFrom(value));
System\Windows\Forms\ListViewGroupConverterTests.cs (2)
63Assert.Null(converter.ConvertFrom(value)); 124Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value));
System\Windows\Forms\ListViewItemConverterTests.cs (1)
33Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value));
System\Windows\Forms\ListViewSubItemConverterTests.cs (1)
33Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value));
System\Windows\Forms\OpacityConverterTests.cs (3)
41Assert.Equal(expected, Assert.IsType<double>(converter.ConvertFrom(value)), 5); 51Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value)); 67Assert.Throws<FormatException>(() => converter.ConvertFrom(value));
System\Windows\Forms\PaddingConverterTests.cs (3)
39Assert.Equal(expected, converter.ConvertFrom(value)); 50Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value)); 59Assert.Throws<ArgumentException>("value", () => converter.ConvertFrom(value));
System\Windows\Forms\SpecialFolderEnumConverterTests.cs (1)
17Assert.Equal(Environment.SpecialFolder.CommonDocuments, converter.ConvertFrom("CommonDocuments"));
System\Windows\Forms\TableLayoutPanelCellPositionTests.cs (5)
123Assert.Equal(expected, converter.ConvertFrom(value)); 133Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value)); 142Assert.Throws<ArgumentException>("value", () => converter.ConvertFrom(value)); 149Assert.Throws<ArgumentOutOfRangeException>("column", () => converter.ConvertFrom("-2,2")); 156Assert.Throws<ArgumentOutOfRangeException>("row", () => converter.ConvertFrom("1,-2"));
System\Windows\Forms\TableLayoutPanelTests.cs (4)
413TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 445TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 481TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />")); 545TableLayoutSettings settings = Assert.IsType<TableLayoutSettings>(converter.ConvertFrom(@"<?xml version=""1.0"" encoding=""utf-16""?><Root />"));