/// <summary> /// Gets a value that can be used by the client. /// </summary> /// <remarks> /// This method should be kept in sync with DataContractSurrogateGenerator.EmitToClientConversion. /// </remarks> /// <param name="targetType">The type used by the client.</param> /// <param name="value">The value on the server.</param> /// <returns>A value that can be used by the client.</returns> public static object GetClientValue(Type targetType, object value) { if (value == null) { return(null); } if (targetType == typeof(byte[]) && BinaryTypeUtility.IsTypeBinary(value.GetType())) { return(BinaryTypeUtility.GetByteArrayFromBinary(value)); } return(value); }