Share via


PropertyBag<T>.Item property

Get or set a property on the Bag.

Namespace:  Microsoft.Office.Server.Search.Query
Assembly:  Microsoft.Office.Server.Search (in Microsoft.Office.Server.Search.dll)

Syntax

'Declaration
Public Overrides Default Property Item ( _
    key As String _
) As Object
    Get
    Set
'Usage
Dim instance As PropertyBag
Dim key As String
Dim value As Object

value = instance(key)

instance(key) = value
public override Object this[
    string key
] { get; set; }

Parameters

Property value

Type: System.Object
The property value

Implements

IPropertyCollection.Item[String]

Exceptions

Exception Condition
ArgumentException

If key is null or empty.

KeyNotFoundException

If a property with the specified key is not found on QueryProperties.

FieldAccessException

If the property being set han an internal/private setter.

Remarks

If the passed key matches a property name of the owner class (), that properties getter/setter will be called rather than fecthing it from bag. Note: It is common for that setter/getter to use SetOnBag(String, Object) / GetFromBag(String) to use the bag as the storage for the property. Strongly typed properties with internal setters cannot be set using this indexer.

See also

Reference

PropertyBag<T> class

PropertyBag<T> members

Microsoft.Office.Server.Search.Query namespace