using System.Collections.Generic; using System.Linq; namespace Ropin.Inspection.Model { public class BaseViewModel { public List<Option> GetInspectionContentoptions(string content) { if (content != null && content.Contains("0/0.1/")) { List<string> g = content.Split('(')[1].TrimStart('(').TrimEnd(')').Split('/').ToList(); return (from c in g select new Option { name = c, value = c }).ToList<Option>(); } else { return null; } } } public class Option { public string name { get; set; } public string value { get; set; } } }