127 references to ConvertTo
Microsoft.AspNetCore.Http.Abstractions.Tests (1)
PathStringTests.cs (1)
295
Assert.Equal("/foo", converter.
ConvertTo
(result, typeof(string)));
Microsoft.Maui.Controls (1)
TypeConversionHelper.cs (1)
55
convertedValue = converter.
ConvertTo
(value, targetType) ?? throw new InvalidOperationException($"The {converter.GetType()} returned null when converting {valueType} to {targetType}");
PresentationFramework (2)
System\Windows\Controls\ContentPresenter.cs (1)
1006
e = (UIElement) tc.
ConvertTo
(content, typeof(UIElement));
System\Windows\Markup\Primitives\ElementMarkupObject.cs (1)
808
value = converter.
ConvertTo
(expression, typeof(MarkupExtension));
System.Drawing.Common.Tests (18)
System\Drawing\FontConverterTests.cs (1)
121
InstanceDescriptor descriptor = (InstanceDescriptor)converter.
ConvertTo
(font, typeof(InstanceDescriptor));
System\Drawing\IconConverterTests.cs (6)
136
Assert.Equal(_iconStr, (string)_icoConv.
ConvertTo
(_icon, typeof(string)));
141
newIconBytes = (byte[])_icoConv.
ConvertTo
(_icon, _iconBytes.GetType());
153
Assert.Equal(_iconStr, (string)_icoConvFrmTD.
ConvertTo
(_icon, typeof(string)));
158
newIconBytes = (byte[])_icoConvFrmTD.
ConvertTo
(_icon, _iconBytes.GetType());
171
Assert.Equal("(none)", (string)_icoConv.
ConvertTo
(null, typeof(string)));
174
Assert.Equal("(none)", (string)_icoConvFrmTD.
ConvertTo
(null, typeof(string)));
System\Drawing\ImageConverterTests.cs (6)
158
Assert.Equal(_imageStr, (string)_imgConv.
ConvertTo
(_image, typeof(string)));
160
Assert.Equal(_imageStr, (string)_imgConvFrmTD.
ConvertTo
(_image, typeof(string)));
164
Assert.Equal("(none)", (string)_imgConv.
ConvertTo
(null, typeof(string)));
167
Assert.Equal("(none)", (string)_imgConvFrmTD.
ConvertTo
(null, typeof(string)));
181
newImageBytes = (byte[])_imgConvFrmTD.
ConvertTo
(_image, _imageBytes.GetType());
190
byte[] converted = (byte[])converter.
ConvertTo
(value, typeof(byte[]));
System\Drawing\ImageFormatConverterTests.cs (4)
131
Assert.Equal(_imageFmtStr, (string)_imgFmtConv.
ConvertTo
(_imageFmt, typeof(string)));
134
Assert.Equal(_imageFmtStr, (string)_imgFmtConvFrmTD.
ConvertTo
(_imageFmt, typeof(string)));
136
Assert.Equal(string.Empty, (string)_imgFmtConv.
ConvertTo
(null, typeof(string)));
139
Assert.Equal(string.Empty, (string)_imgFmtConvFrmTD.
ConvertTo
(null, typeof(string)));
System\Drawing\Printing\MarginsConverterTests.cs (1)
143
Assert.Equal(string.Empty, (string)mc.
ConvertTo
(null, typeof(string)));
System.Windows.Controls.Ribbon (1)
Microsoft\Windows\Controls\Ribbon\RibbonHelper.cs (1)
1577
DynamicResourceExtension dynamicResource = _rreConverter.
ConvertTo
(expr, typeof(MarkupExtension)) as DynamicResourceExtension;
System.Windows.Forms (5)
System\Resources\ResXDataNode.cs (1)
268
byte[]? data = (byte[]?)converter.
ConvertTo
(value, typeof(byte[]));
System\Windows\Forms\ComponentModel\COM2Interop\Com2PropertyDescriptor.Com2PropDescMainConverter.cs (1)
43
? baseConverter.
ConvertTo
(value, destinationType)
System\Windows\Forms\Controls\DataGridView\DataGridView.DataConnection.cs (1)
1484
value = valueConverter.
ConvertTo
(value, columnType);
System\Windows\Forms\DataBinding\Binding.cs (2)
724
return typeConverter.
ConvertTo
(value, type);
798
return typeConverter.
ConvertTo
(value, type);
System.Windows.Forms.Design (3)
System\ComponentModel\Design\Serialization\CodeDomSerializerBase.cs (2)
1891
if (converter.
ConvertTo
(value, typeof(InstanceDescriptor)) is InstanceDescriptor descriptor && descriptor.MemberInfo is not null)
1903
if (converter.
ConvertTo
(value, typeof(InstanceDescriptor)) is InstanceDescriptor descriptor && descriptor.MemberInfo is not null)
System\ComponentModel\Design\Serialization\EnumCodeDomSerializer.cs (1)
38
values = (Enum[])converter.
ConvertTo
(enumValue, typeof(Enum[]))!;
System.Windows.Forms.Design.Tests (3)
System\Resources\Tools\StronglyTypedResourceBuilderTests.cs (3)
328
ResXDataNode node = new("Image1", converter.
ConvertTo
(bitmap, typeof(byte[])));
408
ResXDataNode node = new("Icon1", converter.
ConvertTo
(icon, typeof(byte[])));
620
ResXDataNode node = new("MediaPlayer1", converter.
ConvertTo
(mediaPlayer.OcxState, typeof(byte[])));
System.Windows.Forms.Tests (83)
System\Resources\ResxDataNodeTests.cs (2)
31
ResXDataNode temp = new("test", converter.
ConvertTo
(bitmap, typeof(byte[])));
45
ResXDataNode temp = new("test", converter.
ConvertTo
(bitmap, typeof(byte[])));
System\Windows\Forms\ColumnHeaderConverterTests.cs (6)
97
InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.
ConvertTo
(value, typeof(InstanceDescriptor)));
107
Assert.Throws<ArgumentException>(() => converter.
ConvertTo
(value, typeof(InstanceDescriptor)));
116
Assert.Equal(expected, converter.
ConvertTo
(value, typeof(string)));
123
Assert.Throws<ArgumentNullException>("destinationType", () => converter.
ConvertTo
(new object(), null));
130
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(1, typeof(InstanceDescriptor)));
139
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(new ColumnHeader(), destinationType));
System\Windows\Forms\CursorConverterTests.cs (16)
78
Assert.Equal("AppStarting", converter.
ConvertTo
(Cursors.AppStarting, typeof(string)));
85
Assert.Throws<FormatException>(() => converter.
ConvertTo
(new Cursor(2), typeof(string)));
94
Assert.Equal(expected, converter.
ConvertTo
(value, typeof(string)));
101
InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.
ConvertTo
(Cursors.AppStarting, typeof(InstanceDescriptor)));
106
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(new Cursor(Cursors.AppStarting.Handle), typeof(InstanceDescriptor)));
113
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(new Cursor(2), typeof(InstanceDescriptor)));
120
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(null, typeof(InstanceDescriptor)));
130
Assert.Equal(data, converter.
ConvertTo
(sourceCursor, typeof(byte[])));
140
Assert.Equal(data, converter.
ConvertTo
(sourceCursor, typeof(byte[])));
147
Assert.Throws<FormatException>(() => converter.
ConvertTo
(Cursors.AppStarting, typeof(byte[])));
148
Assert.Throws<InvalidOperationException>(() => converter.
ConvertTo
(new Cursor(Cursors.AppStarting.Handle), typeof(byte[])));
155
Assert.Throws<InvalidOperationException>(() => converter.
ConvertTo
(new Cursor(2), typeof(byte[])));
162
Assert.Empty(Assert.IsType<byte[]>(converter.
ConvertTo
(null, typeof(byte[]))));
169
Assert.Throws<ArgumentNullException>("destinationType", () => converter.
ConvertTo
(new object(), null));
178
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(1, destinationType));
238
string converted = (string)converter.
ConvertTo
(new Cursor(Cursors.Default.Handle), typeof(string));
System\Windows\Forms\DataGridViewRowConverterTests.cs (1)
27
object descriptor = converter.
ConvertTo
(row, typeof(InstanceDescriptor));
System\Windows\Forms\KeysConverterTests.cs (1)
101
object result = converter.
ConvertTo
(keys, typeof(Enum[]));
System\Windows\Forms\Layout\TableLayoutSettingsTypeConverterTests.cs (12)
165
string result = Assert.IsType<string>(converter.
ConvertTo
(settings, typeof(string)));
188
string result = Assert.IsType<string>(converter.
ConvertTo
(settings, typeof(string)));
206
string result = Assert.IsType<string>(converter.
ConvertTo
(settings, typeof(string)));
215
string result = Assert.IsType<string>(converter.
ConvertTo
(settings, typeof(string)));
229
string result = Assert.IsType<string>(converter.
ConvertTo
(settings, typeof(string)));
242
Assert.Throws<InvalidOperationException>(() => converter.
ConvertTo
(settings, typeof(string)));
251
string result = Assert.IsType<string>(converter.
ConvertTo
(settings, typeof(string)));
263
Assert.Throws<InvalidCastException>(() => converter.
ConvertTo
(settings, typeof(string)));
274
Assert.Throws<InvalidCastException>(() => converter.
ConvertTo
(settings, typeof(string)));
281
Assert.Equal("1", converter.
ConvertTo
(1, typeof(string)));
288
Assert.Throws<ArgumentNullException>("destinationType", () => converter.
ConvertTo
(new object(), null));
299
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(toolStrip.LayoutSettings, destinationType));
System\Windows\Forms\LinkAreaConverterTests.cs (5)
76
Assert.Equal("1, 2", converter.
ConvertTo
(new LinkArea(1, 2), typeof(string)));
85
InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.
ConvertTo
(new LinkArea(1, 2), typeof(InstanceDescriptor)));
94
Assert.Throws<ArgumentNullException>("destinationType", () => converter.
ConvertTo
(new object(), null));
101
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(1, typeof(InstanceDescriptor)));
110
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(default(LinkArea), destinationType));
System\Windows\Forms\LinkConverterTests.cs (6)
74
Assert.Equal("1, 2", converter.
ConvertTo
(new LinkLabel.Link(1, 2), typeof(string)));
83
InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.
ConvertTo
(new LinkLabel.Link(1, 2), typeof(InstanceDescriptor)));
93
InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.
ConvertTo
(new LinkLabel.Link(1, 2, "linkData"), typeof(InstanceDescriptor)));
103
Assert.Throws<ArgumentNullException>("destinationType", () => converter.
ConvertTo
(new object(), null));
110
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(1, typeof(InstanceDescriptor)));
119
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(new LinkLabel.Link(), destinationType));
System\Windows\Forms\ListViewGroupConverterTests.cs (5)
203
InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.
ConvertTo
(value, typeof(InstanceDescriptor)));
214
Assert.Equal(expected, converter.
ConvertTo
(value, typeof(string)));
221
Assert.Throws<ArgumentNullException>("destinationType", () => converter.
ConvertTo
(new object(), null));
228
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(1, typeof(InstanceDescriptor)));
237
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(new ListViewGroup(), destinationType));
System\Windows\Forms\ListViewItemConverterTests.cs (5)
258
InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.
ConvertTo
(value, typeof(InstanceDescriptor)));
269
Assert.Equal(expected, converter.
ConvertTo
(value, typeof(string)));
276
Assert.Throws<ArgumentNullException>("destinationType", () => converter.
ConvertTo
(new object(), null));
283
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(1, typeof(InstanceDescriptor)));
292
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(new ListViewItem(), destinationType));
System\Windows\Forms\ListViewSubItemConverterTests.cs (5)
71
InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.
ConvertTo
(value, typeof(InstanceDescriptor)));
82
Assert.Equal(expected, converter.
ConvertTo
(value, typeof(string)));
89
Assert.Throws<ArgumentNullException>("destinationType", () => converter.
ConvertTo
(new object(), null));
96
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(1, typeof(InstanceDescriptor)));
105
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(new ListViewItem.ListViewSubItem(), destinationType));
System\Windows\Forms\OpacityConverterTests.cs (4)
88
Assert.Equal(expected, converter.
ConvertTo
(value, typeof(string)));
96
Assert.Throws<ArgumentNullException>("destinationType", () => converter.
ConvertTo
(new object(), null));
103
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(1, typeof(InstanceDescriptor)));
113
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(1.1, destinationType));
System\Windows\Forms\PaddingConverterTests.cs (6)
79
Assert.Equal("1, 2, 3, 4", converter.
ConvertTo
(new Padding(1, 2, 3, 4), typeof(string)));
88
InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.
ConvertTo
(new Padding(1, 2, 3, 4), typeof(InstanceDescriptor)));
97
InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.
ConvertTo
(new Padding(1, 1, 1, 1), typeof(InstanceDescriptor)));
106
Assert.Throws<ArgumentNullException>("destinationType", () => converter.
ConvertTo
(new object(), null));
113
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(1, typeof(InstanceDescriptor)));
122
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(default(Padding), destinationType));
System\Windows\Forms\TableLayoutPanelCellPositionTests.cs (4)
175
InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.
ConvertTo
(new TableLayoutPanelCellPosition(1, 2), typeof(InstanceDescriptor)));
185
Assert.Throws<ArgumentNullException>("destinationType", () => converter.
ConvertTo
(new object(), null));
192
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(1, typeof(InstanceDescriptor)));
201
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(default(TableLayoutPanelCellPosition), destinationType));
System\Windows\Forms\TableLayoutStyleTests.cs (5)
139
InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.
ConvertTo
(value, typeof(InstanceDescriptor)));
149
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(new SubTableLayoutStyle { SizeType = sizeType }, typeof(InstanceDescriptor)));
156
Assert.Throws<ArgumentNullException>("destinationType", () => converter.
ConvertTo
(new object(), null));
163
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(1, typeof(InstanceDescriptor)));
172
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(new RowStyle(), destinationType));
System.Xaml.Tests (10)
System\Windows\Markup\StaticExtensionTests.cs (5)
216
InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.
ConvertTo
(extension, typeof(InstanceDescriptor)));
226
Assert.IsType<InstanceDescriptor>(converter.
ConvertTo
(extension, typeof(InstanceDescriptor)));
227
Assert.Equal(extension.ToString(), converter.
ConvertTo
(extension, typeof(string)));
235
Assert.Throws<ArgumentException>(() => converter.
ConvertTo
(1, typeof(InstanceDescriptor)));
243
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(extension, typeof(int)));
System\Windows\Markup\TypeExtensionTests.cs (5)
177
InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.
ConvertTo
(extension, typeof(InstanceDescriptor)));
187
Assert.IsType<InstanceDescriptor>(converter.
ConvertTo
(extension, typeof(InstanceDescriptor)));
188
Assert.Equal(extension.ToString(), converter.
ConvertTo
(extension, typeof(string)));
196
Assert.Throws<ArgumentException>(() => converter.
ConvertTo
(1, typeof(InstanceDescriptor)));
204
Assert.Throws<NotSupportedException>(() => converter.
ConvertTo
(extension, typeof(int)));