TryGetPropertyTypeGeneric<T> method
bool
TryGetPropertyTypeGeneric<T>(
- PropertyDefinition propertyDefinition,
- OutParam<
T> propertyValue
Implementation
bool TryGetPropertyTypeGeneric<T>(
PropertyDefinition propertyDefinition, OutParam<T> propertyValue) {
// Verify that the type parameter and property definition's type are compatible.
// todo("implement verifing")
// if (!typeof(T).IsAssignableFrom(propertyDefinition.Type))
// {
// String errorMessage = string.Format(
// Strings.PropertyDefinitionTypeMismatch,
// EwsUtilities.GetPrintableTypeName(propertyDefinition.Type),
// EwsUtilities.GetPrintableTypeName(typeof(T)));
// throw new ArgumentException(errorMessage, "propertyDefinition");
// }
OutParam<Object> value = new OutParam<Object>();
bool result = this.TryGetProperty(propertyDefinition, value);
if (result) {
propertyValue.param = value.param as T?;
} else {
propertyValue.param = null;
}
// propertyValue = result ? (T)value : default(T);
return result;
}