IDataObject.SetData Method

Definition

Stores the specified data in this data object.

Overloads

SetData(Object)

Stores the specified data in this data object, automatically converting the data format from the source object type.

SetData(String, Object)

Stores the specified data in this data object, along with one or more specified data formats. The data format is specified by a string.

SetData(Type, Object)

Stores the specified data in this data object, along with one or more specified data formats. The data format is specified by a Type class.

SetData(String, Object, Boolean)

Stores the specified data in this data object, along with one or more specified data formats. This overload includes a Boolean flag to indicate whether the data may be converted to another format on retrieval.

SetData(Object)

Stores the specified data in this data object, automatically converting the data format from the source object type.

C#
[System.Security.SecurityCritical]
public void SetData(object data);
C#
public void SetData(object data);

Parameters

data
Object

The data to store in this data object.

Attributes

Remarks

For an implementation of this method, see SetData.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

SetData(String, Object)

Stores the specified data in this data object, along with one or more specified data formats. The data format is specified by a string.

C#
[System.Security.SecurityCritical]
public void SetData(string format, object data);
C#
public void SetData(string format, object data);

Parameters

format
String

A string that specifies what format to store the data in. See the DataFormats class for a set of pre-defined data formats.

data
Object

The data to store in this data object.

Attributes

Remarks

For an implementation of this method, see SetData.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

SetData(Type, Object)

Stores the specified data in this data object, along with one or more specified data formats. The data format is specified by a Type class.

C#
[System.Security.SecurityCritical]
public void SetData(Type format, object data);
C#
public void SetData(Type format, object data);

Parameters

format
Type

A Type that specifies what format to store the data in. See the DataFormats class for a set of predefined data formats.

data
Object

The data to store in this data object.

Attributes

Remarks

For an implementation of this method, see SetData.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

SetData(String, Object, Boolean)

Stores the specified data in this data object, along with one or more specified data formats. This overload includes a Boolean flag to indicate whether the data may be converted to another format on retrieval.

C#
[System.Security.SecurityCritical]
public void SetData(string format, object data, bool autoConvert);
C#
public void SetData(string format, object data, bool autoConvert);

Parameters

format
String

A string that specifies what format to store the data in. See the DataFormats class for a set of pre-defined data formats.

data
Object

The data to store in this data object.

autoConvert
Boolean

true to allow the data to be converted to another format on retrieval; false to prohibit the data from being converted to another format on retrieval.

Attributes

Remarks

For an implementation of this method, see SetData.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10