using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Consulenza.WebTemplateModeler.Entity { public class Option { public string Key { get; set; } public string Value { get; set; } public static List Format(string dato) { List opz = new List(); dato = dato.Trim(); if (!dato.Equals("")) { foreach (string o in dato.Split('&')) { if (!o.Equals("")) { string[] oo = o.Split('='); Option option = new Option(); if (!oo[0].Equals("")) option.Key = oo[0]; if (oo.Length > 1 && !oo[1].Equals("")) option.Value = oo[1]; opz.Add(option); } } } return opz; } public static string Format(List opz) { string risp = ""; foreach (Option o in opz) { risp += "&" + o.Key + (!o.Value.Equals("") ? "=" + o.Value : ""); } return risp; } } }