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