public static List<MeminfoModel> ConvertMeminfo(string meminfoText) { List<MeminfoModel> meminfoList = new List<MeminfoModel>(); string[] rowDivider = new String[] { "\n" }; string[] cellDivider = new String[] { ": " }; string[] rowList = meminfoText.Split(rowDivider, StringSplitOptions.None).ToArray(); foreach (string row in rowList) { if (!string.IsNullOrEmpty(row)) { string[] cellList = row.Split(cellDivider, StringSplitOptions.None).ToArray(); MeminfoModel meminfo = new MeminfoModel { key = cellList[0], value = cellList[1] }; meminfoList.Add(meminfo); } } return meminfoList; }
public static List <MeminfoModel> ConvertMeminfo(string meminfoText) { List <MeminfoModel> meminfoList = new List <MeminfoModel>(); string[] rowDivider = new String[] { "\n" }; string[] cellDivider = new String[] { ": " }; string[] rowList = meminfoText.Split(rowDivider, StringSplitOptions.None).ToArray(); foreach (string row in rowList) { if (!string.IsNullOrEmpty(row)) { string[] cellList = row.Split(cellDivider, StringSplitOptions.None).ToArray(); MeminfoModel meminfo = new MeminfoModel { key = cellList[0], value = cellList[1] }; meminfoList.Add(meminfo); } } return(meminfoList); }
public static List <MeminfoModel> Meminfo(string meminfoText) { List <MeminfoModel> meminfoList = new List <MeminfoModel>(); string[] rowDivider = new String[] { "\n" }; string[] cellDivider = new String[] { ": " }; string[] rowList = meminfoText.Split(rowDivider, StringSplitOptions.None).ToArray(); foreach (string row in rowList) { if (row != null && row != "") { string[] cellList = row.Split(cellDivider, StringSplitOptions.None).ToArray(); MeminfoModel meminfo = new MeminfoModel(); meminfo.key = cellList[0]; meminfo.value = cellList[1]; meminfoList.Add(meminfo); } } return(meminfoList); }