Implemented interface member:
method
GetData
System.Windows.Forms.IDataObject.GetData(System.String, System.Boolean)
85 references to GetData
System.Windows.Forms (5)
System\Windows\Forms\OLE\DataObject.cs (5)
98public virtual object? GetData(string format) => GetData(format, autoConvert: true); 138public virtual Stream? GetAudioStream() => GetData(DataFormats.WaveAudio, autoConvert: false) as Stream; 143if (GetData(DataFormats.FileDropConstant, autoConvert: true) is string[] strings) 151public virtual Image? GetImage() => GetData(DataFormats.Bitmap, autoConvert: true) as Image; 159return GetData(ConvertToDataFormats(format), false) is string text ? text : string.Empty;
System.Windows.Forms.Tests (80)
System\Windows\Forms\DataObjectTests.ClipboardTests.cs (5)
48dataObject.GetData(format, autoConvert).Should().BeNull(); 116dataObject.GetData(format, autoConvert: false).Should().BeSameAs(input); 117dataObject.GetData(format, autoConvert: true).Should().BeSameAs(input); 173dataObject.GetData(format, autoConvert: false).Should().Be(input); 174dataObject.GetData(format, autoConvert: true).Should().Be(input);
System\Windows\Forms\DataObjectTests.cs (75)
233.Setup(o => o.GetData(DataFormats.WaveAudio, false)) 237mockDataObject.Verify(o => o.GetData(DataFormats.WaveAudio, false), Times.Once()); 276.Setup(o => o.GetData(format, true)) 280mockDataObject.Verify(o => o.GetData(format, true), Times.Once()); 324dataObject.GetData(format, autoConvert).Should().BeSameAs(result); 523.Setup(o => o.GetData(DataFormats.FileDrop, true)) 527mockDataObject.Verify(o => o.GetData(DataFormats.FileDrop, true), Times.Once()); 693.Setup(o => o.GetData(DataFormats.Bitmap, true)) 697mockDataObject.Verify(o => o.GetData(DataFormats.Bitmap, true), Times.Once()); 799.Setup(o => o.GetData(expectedFormat, false)) 803mockDataObject.Verify(o => o.GetData(expectedFormat, false), Times.Once()); 829dataObject.GetData(DataFormats.WaveAudio, autoConvert: true).Should().BeOfType<MemoryStream>().Subject.ToArray().Should().Equal(audioBytes); 830dataObject.GetData(DataFormats.WaveAudio, autoConvert: false).Should().BeOfType<MemoryStream>().Subject.ToArray().Should().Equal(audioBytes); 887dataObject.GetData(DataFormats.WaveAudio, autoConvert: true).Should().BeSameAs(audioStream); 888dataObject.GetData(DataFormats.WaveAudio, autoConvert: false).Should().BeSameAs(audioStream); 945dataObject.GetData(format, autoConvert: false).Should().BeSameAs(data); 946dataObject.GetData(format, autoConvert: true).Should().BeSameAs(data); 961dataObject.GetData(format, autoConvert: false).Should().Be(data2); 962dataObject.GetData(format, autoConvert: true).Should().Be(data2); 977dataObject.GetData(DataFormats.Serializable, autoConvert: false).Should().Be(data1); 978dataObject.GetData(DataFormats.Serializable, autoConvert: true).Should().Be(data1); 979dataObject.GetData(data2.GetType().FullName, autoConvert: false).Should().Be(data2); 980dataObject.GetData(data2.GetType().FullName, autoConvert: true).Should().Be(data2); 1029dataObject.GetData(format, autoConvert: false).Should().Be(input); 1030dataObject.GetData(format, autoConvert: true).Should().Be(input); 1051dataObject.GetData(DataFormats.Bitmap, autoConvert: true).Should().BeSameAs(image); 1052dataObject.GetData(DataFormats.Bitmap, autoConvert: false).Should().BeSameAs(image); 1053dataObject.GetData(typeof(Bitmap).FullName, autoConvert: true).Should().BeSameAs(image); 1054dataObject.GetData(typeof(Bitmap).FullName, autoConvert: false).Should().BeNull(); 1055dataObject.GetData(DataFormats.Dib, autoConvert: true).Should().BeNull(); 1056dataObject.GetData(DataFormats.Dib, autoConvert: false).Should().BeNull(); 1106dataObject.GetData(format, autoConvert: false).Should().Be(input); 1107dataObject.GetData(format, autoConvert: true).Should().Be(input); 1131dataObject.GetData(DataFormats.Bitmap, autoConvert: true).Should().BeSameAs(image); 1132dataObject.GetData(DataFormats.Bitmap, autoConvert: false).Should().BeSameAs(image); 1133dataObject.GetData(typeof(Bitmap).FullName, autoConvert: true).Should().BeSameAs(image); 1134dataObject.GetData(typeof(Bitmap).FullName, autoConvert: false).Should().BeNull(); 1135dataObject.GetData(DataFormats.Dib, autoConvert: true).Should().BeNull(); 1136dataObject.GetData(DataFormats.Dib, autoConvert: false).Should().BeNull(); 1252dataObject.GetData(DataFormats.FileDrop, autoConvert: true).Should().BeEquivalentTo(filePaths.Cast<string>()); 1253dataObject.GetData(DataFormats.FileDrop, autoConvert: false).Should().BeEquivalentTo(filePaths.Cast<string>()); 1254dataObject.GetData("FileName", autoConvert: true).Should().BeEquivalentTo(filePaths.Cast<string>()); 1255dataObject.GetData("FileName", autoConvert: false).Should().BeNull(); 1256dataObject.GetData("FileNameW", autoConvert: true).Should().BeEquivalentTo(filePaths.Cast<string>()); 1257dataObject.GetData("FileNameW", autoConvert: false).Should().BeNull(); 1312dataObject.GetData(DataFormats.Bitmap, autoConvert: true).Should().BeSameAs(image); 1313dataObject.GetData(DataFormats.Bitmap, autoConvert: false).Should().BeSameAs(image); 1314dataObject.GetData(typeof(Bitmap).FullName, autoConvert: true).Should().BeSameAs(image); 1315dataObject.GetData(typeof(Bitmap).FullName, autoConvert: false).Should().BeNull(); 1316dataObject.GetData(DataFormats.Dib, autoConvert: true).Should().BeNull(); 1317dataObject.GetData(DataFormats.Dib, autoConvert: false).Should().BeNull(); 1380dataObject.GetData(DataFormats.UnicodeText, autoConvert: true).Should().BeSameAs(textData); 1381dataObject.GetData(DataFormats.UnicodeText, autoConvert: false).Should().BeSameAs(textData); 1382dataObject.GetData(DataFormats.Text, autoConvert: true).Should().BeSameAs(textData); 1383dataObject.GetData(DataFormats.Text, autoConvert: false).Should().BeNull(); 1384dataObject.GetData(DataFormats.StringFormat, autoConvert: true).Should().BeSameAs(textData); 1385dataObject.GetData(DataFormats.StringFormat, autoConvert: false).Should().BeNull(); 1386dataObject.GetData(DataFormats.Rtf, autoConvert: true).Should().BeNull(); 1387dataObject.GetData(DataFormats.Rtf, autoConvert: false).Should().BeNull(); 1388dataObject.GetData(DataFormats.Html, autoConvert: true).Should().BeNull(); 1389dataObject.GetData(DataFormats.Html, autoConvert: false).Should().BeNull(); 1390dataObject.GetData(DataFormats.CommaSeparatedValue, autoConvert: true).Should().BeNull(); 1391dataObject.GetData(DataFormats.CommaSeparatedValue, autoConvert: false).Should().BeNull(); 1459dataObject.GetData(DataFormats.UnicodeText, autoConvert: true).Should().Be(expectedUnicodeText); 1460dataObject.GetData(DataFormats.UnicodeText, autoConvert: false).Should().Be(expectedUnicodeText); 1461dataObject.GetData(DataFormats.Text, autoConvert: true).Should().Be(expectedUnicodeText); 1462dataObject.GetData(DataFormats.Text, autoConvert: false).Should().BeNull(); 1463dataObject.GetData(DataFormats.StringFormat, autoConvert: true).Should().Be(expectedUnicodeText); 1464dataObject.GetData(DataFormats.StringFormat, autoConvert: false).Should().BeNull(); 1465dataObject.GetData(DataFormats.Rtf, autoConvert: true).Should().Be(expectedRtfText); 1466dataObject.GetData(DataFormats.Rtf, autoConvert: false).Should().Be(expectedRtfText); 1467dataObject.GetData(DataFormats.Html, autoConvert: true).Should().Be(expectedHtmlText); 1468dataObject.GetData(DataFormats.Html, autoConvert: false).Should().Be(expectedHtmlText); 1469dataObject.GetData(DataFormats.CommaSeparatedValue, autoConvert: true).Should().Be(expectedCsvText); 1470dataObject.GetData(DataFormats.CommaSeparatedValue, autoConvert: false).Should().Be(expectedCsvText);