operator [] method
Gets the value of specified property in this instance.
Definition of the property to get.
Implementation
Object? operator [](PropertyDefinitionBase propertyDefinition) {
Object? propertyValue;
PropertyDefinition propDef = propertyDefinition as PropertyDefinition;
if (propDef != null) {
return this.PropertyBag[propDef];
} else {
ExtendedPropertyDefinition extendedPropDef =
propertyDefinition as ExtendedPropertyDefinition;
if (extendedPropDef != null) {
OutParam<Object> propertyValueOutParam = OutParam();
if (this
.TryGetExtendedProperty(extendedPropDef, propertyValueOutParam)) {
return propertyValue;
} else {
throw new ServiceObjectPropertyException(
/*Strings.MustLoadOrAssignPropertyBeforeAccess,*/
propertyDefinition);
}
} else {
// Other subclasses of PropertyDefinitionBase are not supported.
throw new NotSupportedException("""string.Format(
Strings.OperationNotSupportedForPropertyDefinitionType,
propertyDefinition.GetType().Name)""");
}
}
}