public void CopyTo(Array array, int index) { GamePredicate [] buffer = new GamePredicate [array.Length]; clauses.CopyTo(buffer, index); for (int i = 0; i < array.Length; i++) { array.SetValue(unparse(buffer [i]), i); } }
/// <summary> /// Converts a predicate to a string in the format "[body].[property]". /// </summary> /// /// <param name="innerData">The predicate to convert.</param> /// <returns>A string <c>x</c> such that <c>parse(x) == innerData</c>.</returns> /// /// <exception cref="ArgumentException">Thrown if <c>innerData</c> does not correspond to /// any string in the desired format.</exception> static string unparse(GamePredicate innerData) { try { return(innerData.ToString()); } catch (InvalidOperationException e) { throw new ArgumentException( Localizer.Format("#autoLOC_CustomAsteroids_ErrorConditionStateBadPred", innerData), nameof(innerData), e); } }