PropertyDataCollection.Add 方法

定义

添加一个新的 PropertyData 对象。Adds a new PropertyData object.

重载

Add(String, Object)

添加新的、带有指定值的 PropertyDataAdds a new PropertyData with the specified value. 值不能为 null,并且必须能够转换为公共信息模型 (CIM) 类型。The value cannot be null and must be convertible to a Common Information Model (CIM) type.

Add(String, CimType, Boolean)

添加新的、没有赋值的 PropertyDataAdds a new PropertyData with no assigned value.

Add(String, Object, CimType)

添加一个具有指定值和公共信息模型 (CIM) 类型的新 PropertyDataAdds a new PropertyData with the specified value and Common Information Model (CIM) type.

Add(String, Object)

添加新的、带有指定值的 PropertyDataAdds a new PropertyData with the specified value. 值不能为 null,并且必须能够转换为公共信息模型 (CIM) 类型。The value cannot be null and must be convertible to a Common Information Model (CIM) type.

public:
 virtual void Add(System::String ^ propertyName, System::Object ^ propertyValue);
public virtual void Add (string propertyName, object propertyValue);
abstract member Add : string * obj -> unit
override this.Add : string * obj -> unit
Public Overridable Sub Add (propertyName As String, propertyValue As Object)

参数

propertyName
String

新属性的名称。The name of the new property.

propertyValue
Object

属性的值(不能为 null)。The value of the property (cannot be null).

注解

只能将属性添加到类定义, 而不能添加到实例。Properties can only be added to class definitions, not to instances. 仅当在PropertyDataCollection ManagementClass中的调用时, 此方法才有效。This method is only valid when invoked on a PropertyDataCollection in a ManagementClass.

.NET Framework 安全性.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.

Add(String, CimType, Boolean)

添加新的、没有赋值的 PropertyDataAdds a new PropertyData with no assigned value.

public:
 void Add(System::String ^ propertyName, System::Management::CimType propertyType, bool isArray);
public void Add (string propertyName, System.Management.CimType propertyType, bool isArray);
member this.Add : string * System.Management.CimType * bool -> unit
Public Sub Add (propertyName As String, propertyType As CimType, isArray As Boolean)

参数

propertyName
String

属性的名称。The name of the property.

propertyType
CimType

属性的公共信息模型 (CIM) 类型。The Common Information Model (CIM) type of the property.

isArray
Boolean

若为 true,则指定属性为数组类型;否则为 falsetrue to specify that the property is an array type; otherwise, false.

注解

只能将属性添加到类定义, 而不能添加到实例。Properties can only be added to class definitions, not to instances. 仅当在PropertyDataCollection ManagementClass中的调用时, 此方法才有效。This method is only valid when invoked on a PropertyDataCollection in a ManagementClass.

.NET Framework 安全性.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.

Add(String, Object, CimType)

添加一个具有指定值和公共信息模型 (CIM) 类型的新 PropertyDataAdds a new PropertyData with the specified value and Common Information Model (CIM) type.

public:
 void Add(System::String ^ propertyName, System::Object ^ propertyValue, System::Management::CimType propertyType);
public void Add (string propertyName, object propertyValue, System.Management.CimType propertyType);
member this.Add : string * obj * System.Management.CimType -> unit
Public Sub Add (propertyName As String, propertyValue As Object, propertyType As CimType)

参数

propertyName
String

属性的名称。The name of the property.

propertyValue
Object

属性的值(可以为 null)。The value of the property (which can be null).

propertyType
CimType

属性的 CIM 类型。The CIM type of the property.

注解

只能将属性添加到类定义, 而不能添加到实例。Properties can only be added to class definitions, not to instances. 仅当在PropertyDataCollection ManagementClass中的调用时, 此方法才有效。This method is only valid when invoked on a PropertyDataCollection in a ManagementClass.

.NET Framework 安全性.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.

适用于