private object GetBeanPropInternal(object @object, int index) { try { var value = _method.Invoke(@object, null) as Array; if (value == null) return null; if (value.Length <= index) return null; return value.GetValue(index); } catch (InvalidCastException e) { throw PropertyUtility.GetMismatchException(_method, @object, e); } catch (TargetInvocationException e) { throw PropertyUtility.GetInvocationTargetException(_method, e); } catch (TargetException e) { throw PropertyUtility.GetGenericException(_method, e); } catch (MemberAccessException e) { throw PropertyUtility.GetIllegalAccessException(_method, e); } catch (ArgumentException e) { throw PropertyUtility.GetIllegalArgumentException(_method, e); } }
private object GetBeanPropInternal(object @object, int index) { try { var value = _field.GetValue(@object); if (!(value is IList<object>)) return null; var valueList = (IList<object>) value; if (valueList.Count <= index) return null; return valueList[index]; } catch (InvalidCastException e) { throw PropertyUtility.GetMismatchException(_field, @object, e); } catch (MemberAccessException e) { throw PropertyUtility.GetIllegalAccessException(_field, e); } catch (ArgumentException e) { throw PropertyUtility.GetIllegalArgumentException(_field, e); } }
private Object GetBeanPropInternal(Object @object, int index) { try { var value = (Array)_field.GetValue(@object); if (value.Length <= index) { return(null); } return(value.GetValue(index)); } catch (InvalidCastException e) { throw PropertyUtility.GetMismatchException(_field, @object, e); } catch (MethodAccessException e) { throw PropertyUtility.GetIllegalAccessException(_field, e); } catch (ArgumentException e) { throw PropertyUtility.GetIllegalArgumentException(_field, e); } }