/// <summary> /// Read value from <see cref="grpc.ArrayValue"/>. /// </summary> /// <param name="array"><see cref="grpc.ArrayValue"/> to read from.</param> /// <returns>Array of values.</returns> public static object[] ToCLR(this grpc.ArrayValue array) { var list = new List <object>(); list.AddRange(array.Values.Select(val => val.ToCLR())); return(list.ToArray()); }
/// <summary> /// Converts a <see cref="IEnumerable"/> to <see cref="grpc.ArrayValue"/>. /// </summary> /// <param name="enumerable"><see cref="IEnumerable"/> to convert.</param> /// <returns>Converted <see cref="grpc.ArrayValue"/>.</returns> public static grpc.ArrayValue ToProtobuf(this IEnumerable enumerable) { var arrayValue = new grpc.ArrayValue(); foreach (var item in enumerable) { arrayValue.Values.Add(item.ToProtobuf()); } return(arrayValue); }