Edit

Share via


MethodDataCollection.Add Method

Definition

Adds a MethodData object to the MethodDataCollection.

Overloads

Add(String)

Adds a MethodData to the MethodDataCollection. This overload will add a new method with no parameters to the collection.

Add(String, ManagementBaseObject, ManagementBaseObject)

Adds a MethodData to the MethodDataCollection. This overload will add a new method with the specified parameter objects to the collection.

Add(String)

Source:
MethodSet.cs
Source:
MethodSet.cs
Source:
MethodSet.cs

Adds a MethodData to the MethodDataCollection. This overload will add a new method with no parameters to the collection.

C#
public virtual void Add(string methodName);

Parameters

methodName
String

The name of the method to add.

Remarks

Adding MethodData objects to the MethodDataCollection can only be done when the class has no instances. Any other case will result in an exception.

.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, ManagementBaseObject, ManagementBaseObject)

Source:
MethodSet.cs
Source:
MethodSet.cs
Source:
MethodSet.cs

Adds a MethodData to the MethodDataCollection. This overload will add a new method with the specified parameter objects to the collection.

C#
public virtual void Add(string methodName, System.Management.ManagementBaseObject inParameters, System.Management.ManagementBaseObject outParameters);
C#
public virtual void Add(string methodName, System.Management.ManagementBaseObject inParams, System.Management.ManagementBaseObject outParams);

Parameters

methodName
String

The name of the method to add.

inParametersinParams
ManagementBaseObject

The ManagementBaseObject holding the input parameters to the method.

outParametersoutParams
ManagementBaseObject

The ManagementBaseObject holding the output parameters to the method.

Remarks

Adding MethodData objects to the MethodDataCollection can only be done when the class has no instances. Any other case will result in an exception.

.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)