public static string Format <T>(T[] array, Func <T, int, string> itemFormatter, Range range) { var arrayFormatting = CurrentArrayFormatting; return(PwrArray.Format(array, itemFormatter, arrayFormatting.DelimiterChar.ToString(), arrayFormatting.OpenBracketChar.ToString(), arrayFormatting.CloseBracketChar.ToString(), range)); }
public static string FormatRegular <T>(Array array, Func <T, int, int[], string> itemFormatter) { var arrayFormatting = CurrentArrayFormatting; return(PwrArray.FormatAsRegular <T>(array, itemFormatter, i => arrayFormatting.DelimiterChar.ToString(), i => arrayFormatting.OpenBracketChar.ToString(), i => arrayFormatting.CloseBracketChar.ToString())); }
public SqlRangeRegularArray(int[] lengths) { if (lengths != null && lengths.Any(l => l < 0)) { throw new ArgumentException("One or many items have invalid values.", "lengths"); } _array = PwrArray.CreateAsRegular <Range?>(lengths); _arrayInfo = new RegularArrayInfo(lengths); }
public SqlStringRegularArray(int[] lengths, Encoding encoding) { if (lengths != null && lengths.Any(t => t < 0)) { throw new ArgumentException("One or many items have invalid values.", "lengths"); } _array = PwrArray.CreateAsRegular <String>(lengths); _arrayInfo = new RegularArrayInfo(lengths); _encoding = encoding; }
public static T[] ParseCollection <T>(string s, Func <string, int, T> itemParser, string itemPattern = null) { var collFormatting = CurrentArrayFormatting; var coll = PwrArray.Parse <T>(s, itemParser, itemPattern, new[] { collFormatting.DelimiterChar }, collFormatting.SpaceChars.ToArray(), new[] { collFormatting.EscapeChar }); if (coll == null) { throw new FormatException(); } return(coll); }
public static T[] ParseArray <T>(string s, Func <string, int, T> itemParser, string itemPattern = null) { var arrayFormatting = CurrentArrayFormatting; var array = PwrArray.Parse <T>(s, itemParser, itemPattern, new[] { arrayFormatting.DelimiterChar }, arrayFormatting.SpaceChars.ToArray(), new[] { arrayFormatting.EscapeChar }, new[] { arrayFormatting.OpenBracketChar }, new[] { arrayFormatting.CloseBracketChar }); if (array == null) { throw new FormatException(); } return(array); }
public static Array ReadLongRegularArray <T>(this BinaryReader reader, Func <BinaryReader, long, long[], T> itemReader, long[] indices, long[] lengths) { if (reader == null) { throw new ArgumentNullException("reader"); } if (itemReader == null) { throw new ArgumentNullException("itemReader"); } Array array = PwrArray.CreateAsLongRegular <T>(lengths); long total = 0L; try { array.FillAsLongRegular((fi, di) => { var v = itemReader(reader, fi, di); total = fi + 1L; return(v); }, indices); } catch (Exception ex) when(ThrowDataInfo) { throw new StreamReadLongException(array, total, ex); } return(array); }
public ArgumentJaggedArrayLongElementException(string paramName, string message, params long[][] indices) : base(string.Format(message, PwrArray.FormatAsLongJaggedIndices(indices)), paramName) { _indices = (long[][])indices.CloneAsJagged(); }
public ArgumentJaggedArrayLongElementException(params long[][] indices) : base(string.Format(DefaultMessage, PwrArray.FormatAsLongJaggedIndices(indices))) { _indices = (long[][])indices.CloneAsJagged(); }
public ArgumentRegularArrayElementException(string paramName, string message, Exception innerException, int index) : base(string.Format(message, PwrArray.FormatAsRegularIndices(new int[] { index })), paramName, innerException) { _indices = new int[] { index }; }
public ArgumentRegularArrayElementException(string paramName, string message, params int[] indices) : base(string.Format(message, PwrArray.FormatAsRegularIndices(indices)), paramName) { _indices = (int[])indices.Clone(); }
public ArgumentRegularArrayElementException(string paramName, Exception innerException, params int[] indices) : base(string.Format(DefaultMessage, PwrArray.FormatAsRegularIndices(indices)), paramName, innerException) { _indices = (int[])indices.Clone(); }
public ArgumentRegularArrayElementException(string paramName, int index) : base(string.Format(DefaultMessage, PwrArray.FormatAsRegularIndices(new int[] { index })), paramName) { _indices = new int[] { index }; }
public ArgumentRegularArrayLongElementException(string paramName, params long[] indices) : base(string.Format(DefaultMessage, PwrArray.FormatAsLongRegularIndices(indices)), paramName) { _indices = (long[])indices.Clone(); }
public ArgumentJaggedArrayElementException(string paramName, params int[][] indices) : base(string.Format(DefaultMessage, PwrArray.FormatAsJaggedIndices(indices)), paramName) { _indices = (int[][])indices.CloneAsJagged(); }
public ArgumentRegularArrayLongElementException(string paramName, Exception innerException, long index) : base(string.Format(DefaultMessage, PwrArray.FormatAsLongRegularIndices(new long[] { index })), paramName, innerException) { _indices = new long[] { index }; }
public ArgumentRegularArrayLongElementException(string paramName, string message, long index) : base(string.Format(message, PwrArray.FormatAsLongRegularIndices(new long[] { index })), paramName) { _indices = new long[] { index }; }
public ArgumentRegularArrayLongElementException(string paramName, string message, Exception innerException, params long[] indices) : base(string.Format(message, PwrArray.FormatAsLongRegularIndices(indices)), paramName, innerException) { _indices = (long[])indices.Clone(); }
public ArgumentJaggedArrayElementException(string paramName, string message, Exception innerException, params int[][] indices) : base(string.Format(message, PwrArray.FormatAsJaggedIndices(indices)), paramName, innerException) { _indices = (int[][])indices.CloneAsJagged(); }
public ArgumentRegularArrayLongElementException(long index) : base(string.Format(DefaultMessage, PwrArray.FormatAsLongRegularIndices(new long[] { index }))) { _indices = new long[] { index }; }