public void TestStringRepresentation() { var a = new uint[2]; a[0] = 10; a[1] = 123; Assert.AreEqual("10\\123", ArrayHelperMethods.GetStringRepresentation(a)); }
/// <summary> /// Returns the supplied value unchanged unless it is an Array or an IDictionary in which case it will be converted into a string representation (including support /// for sub arrays / trees within arrays and vice versa). /// </summary> /// <param name="value"></param> /// <returns></returns> public static object Flatten(object value) { if (value is Array) { return(ArrayHelperMethods.GetStringRepresentation((Array)value).Trim()); } if (value is IDictionary) { return(DictionaryHelperMethods.AsciiArt((IDictionary)value).Trim()); } if (value is string) { return(((string)value).Trim()); } return(value); }
private void ShowContentSequence(DicomDataset dataset, DicomTag tag = null) { tag = tag ?? DicomTag.ContentSequence; Console.WriteLine(tag.DictionaryEntry.Keyword + " Contains the following:"); Console.WriteLine("-------------------------------------------------------------"); var array = (Dictionary <DicomTag, object>[])DicomTypeTranslaterReader.GetCSharpValue(dataset, tag); var str = ArrayHelperMethods.AsciiArt(array); foreach (var keyword in DicomDictionary.Default) { str = str.Replace(keyword.Tag.ToString(), keyword.Keyword); } Console.WriteLine(str); Console.WriteLine(); Console.WriteLine("--------------------End Content Sequence--------------------------"); }