PropertyDataCollection.Add Method

Definition

Adds a new PropertyData object.

Overloads

Add(String, Object)

Adds a new PropertyData with the specified value. The value cannot be null and must be convertible to a Common Information Model (CIM) type.

Add(String, CimType, Boolean)

Adds a new PropertyData with no assigned value.

Add(String, Object, CimType)

Adds a new PropertyData with the specified value and Common Information Model (CIM) type.

Add(String, Object)

Source:
PropertySet.cs
Source:
PropertySet.cs
Source:
PropertySet.cs

Adds a new PropertyData with the specified value. The value cannot be null and must be convertible to a Common Information Model (CIM) type.

C#
public virtual void Add(string propertyName, object propertyValue);

Parameters

propertyName
String

The name of the new property.

propertyValue
Object

The value of the property (cannot be null).

Remarks

Properties can only be added to class definitions, not to instances. This method is only valid when invoked on a PropertyDataCollection in a ManagementClass.

.NET Framework Security

Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 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
.NET Standard 2.0 (package-provided)

Add(String, CimType, Boolean)

Source:
PropertySet.cs
Source:
PropertySet.cs
Source:
PropertySet.cs

Adds a new PropertyData with no assigned value.

C#
public void Add(string propertyName, System.Management.CimType propertyType, bool isArray);

Parameters

propertyName
String

The name of the property.

propertyType
CimType

The Common Information Model (CIM) type of the property.

isArray
Boolean

true to specify that the property is an array type; otherwise, false.

Remarks

Properties can only be added to class definitions, not to instances. This method is only valid when invoked on a PropertyDataCollection in a ManagementClass.

.NET Framework Security

Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 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
.NET Standard 2.0 (package-provided)

Add(String, Object, CimType)

Source:
PropertySet.cs
Source:
PropertySet.cs
Source:
PropertySet.cs

Adds a new PropertyData with the specified value and Common Information Model (CIM) type.

C#
public void Add(string propertyName, object propertyValue, System.Management.CimType propertyType);

Parameters

propertyName
String

The name of the property.

propertyValue
Object

The value of the property (which can be null).

propertyType
CimType

The CIM type of the property.

Remarks

Properties can only be added to class definitions, not to instances. This method is only valid when invoked on a PropertyDataCollection in a ManagementClass.

.NET Framework Security

Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 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
.NET Standard 2.0 (package-provided)