source: OniSplit/Xml/XmlWriterExtensions.cs@ 1163

Last change on this file since 1163 was 1114, checked in by iritscen, 5 years ago

Adding OniSplit source code (v0.9.99.0). Many thanks to Neo for all his work over the years.

File size: 822 bytes
RevLine 
[1114]1using System;
2using System.Text;
3using System.Xml;
4
5namespace Oni.Xml
6{
7 internal static class XmlWriterExtensions
8 {
9 public static void WriteFloatArray(this XmlWriter writer, float[] array)
10 {
11 writer.WriteArray(array, XmlConvert.ToString);
12 }
13
14 public static void WriteArray<T>(this XmlWriter writer, T[] array, Func<T, string> converter)
15 {
16 var text = new StringBuilder(array.Length * 8);
17
18 for (int i = 0; i < array.Length; i++)
19 {
20 if (i != array.Length - 1)
21 text.AppendFormat("{0} ", converter(array[i]));
22 else
23 text.Append(converter(array[i]));
24 }
25
26 writer.WriteValue(text.ToString());
27 }
28 }
29}
Note: See TracBrowser for help on using the repository browser.