CSharp examples for System:String Convert
Converts the Dictionary to 2D string tab. String[][] contains two string[], first with keys and second with values.
using System.Xml.Serialization; using System.Collections; using System.Globalization; using System.Collections.Specialized; using System.Text; using System.Collections.Generic; using System;//from w ww . j av a2 s .c o m public class Main{ /// <summary> /// Converts the Dictionary to 2D string tab. /// String[][] contains two string[], first with keys and second with values. /// </summary> /// <param name="dict">The dictionary</param> /// <returns>2D string tab</returns> public static string[][] ConvertDictionaryStringString2ToDStringArr(Dictionary<string, string> dict) { if (dict == null) return null; string[][] tab = new string[2][]; tab[0] = new string[dict.Count]; tab[1] = new string[dict.Count]; int i = 0; foreach (string key in dict.Keys) { tab[0][i] = key; tab[1][i] = dict[key]; i++; } return tab; } }