/// <summary> /// Gets the value. Handles arrays. /// </summary> /// <param name="instance">The instance.</param> /// <returns>The result value.</returns> public object GetValue(object instance) { object value; // Special case for collections if (Index != null) { if (instance is System.Collections.IList asList) { // Get value at index value = asList[(int)Index]; } else if (instance is System.Collections.IDictionary asDictionary) { // Get value at key value = asDictionary[Index]; } else { throw new NotSupportedException(); } } else { // Get value value = Member.GetValue(instance); } return(value); }
public bool GetValue(object instance) { var value = (bool)Source.GetValue(instance); if (Invert) { value = !value; } return(value); }