Share via


PSPrimitiveDictionary.Item[] Property

Definition

Overloads

Item[Object]

Gets or sets the value associated with the specified key.

Item[String]

Gets or sets the value associated with the specified key.

Item[Object]

Gets or sets the value associated with the specified key.

public:
 virtual property System::Object ^ default[System::Object ^] { System::Object ^ get(System::Object ^ key); void set(System::Object ^ key, System::Object ^ value); };
public override object this[object key] { get; set; }
member this.Item(obj) : obj with get, set
Default Public Overrides Property Item(key As Object) As Object

Parameters

key
Object

The key whose value to get or set.

Property Value

The value associated with the specified key.

Exceptions

The setter will throw if the key is not a string and the value is not one of primitive types that will work during PowerShell remoting handshake. Use of strongly-typed overloads of Add method is suggested if throwing an exception is not acceptable.

Remarks

If the specified key is not found, attempting to get it returns null and attempting to set it creates a new element using the specified key.

Applies to

Item[String]

Gets or sets the value associated with the specified key.

public:
 property System::Object ^ default[System::String ^] { System::Object ^ get(System::String ^ key); void set(System::String ^ key, System::Object ^ value); };
public object this[string key] { get; set; }
member this.Item(string) : obj with get, set
Default Public Property Item(key As String) As Object

Parameters

key
String

The key whose value to get or set.

Property Value

The value associated with the specified key.

Exceptions

The setter will throw if the value is not one of primitive types that will work during PowerShell remoting handshake. Use of strongly-typed overloads of Add method is suggested if throwing an exception is not acceptable.

Remarks

If the specified key is not found, attempting to get it returns null and attempting to set it creates a new element using the specified key.

Applies to