Item

This property retrieves a role in the OracleRoleCollection object using an index value.

Declaration

// C#
public string Item[int index] {get;} 

Parameters

  • index - An integer that represents the index value for role name retrieval.

Property Value

A string for the role name

Exceptions

ArgumentOutOfRangeException - Index is outside the range of valid indexes.

Remarks

Roles are stored in alphabetical order by role name. To fetch the role name, the index value should be less than the OracleRoleCollection.Count value. Otherwise, it results in an ArgumentOutOfRangeException.

For Oracle Database 23ai, 23.8 and earlier versions, this property only returns roles specified in OracleConnection.Roles property regardless whether the connection is open or closed.

For Oracle Database and ODP.NET versions 23.9 and later, this property returns the default session roles names enabled on the session when the connection is open.

When a reserved keyword for roles, such as ALL or NONE, is part of the OracleRoleCollection object, this property returns the items added in the roles collection when the connection is closed. When the connection is open, this property returns the session-enabled role names. Similarly, when OracleRoleCollection.UseAllExcept property is set to true and connection is closed, this property returns the OracleRoleCollection item names. When the connection is open, this property returns session-enabled role names.

For DRCP connections, this property returns the role names specified in the OracleRoleCollection object until the connection opens and a session is attached to it.