List<int> My_LIST = new List<int>(); List<string> TMP_LIST = new List<string>(); List<string> RESULT_LIST = new List<string>(); for (int i = 0; i < My_LIST.Count; i++) { TMP_LIST.Clear(); int counter = i; foreach (var item in My_LIST) { if (counter == My_LIST.Count) counter = 0; TMP_LIST.Add(My_LIST[counter].ToString()); counter++; } RESULT_LIST.Add(string.Join("", TMP_LIST)); }
using System.Linq; . . DataTable table1 = new DataTable("First"); ...//fill you first table with data DataTable table2 = new DataTable("Second"); ...//fill you second table with data //loop thrue the first table rows and collect cpt values List<string> cptValuesList1 = new List<string>(); foreach (DataRow row in table1.Rows) { cptValuesList1.Add(row["CPTCode"].ToString()); cptValuesList1.Add(row["CPT"].ToString()); } //remove doubletts cptValuesList1 = cptValuesList1.Distinct().ToList(); //loop thrue the second table rows and collect cpt values List<string> cptValuesList2 = new List<string>(); foreach (DataRow row in table2.Rows) { cptValuesList2.Add(row["CPT"].ToString()); } //remove doubletts cptValuesList2 = cptValuesList2.Distinct().ToList(); //get intersected values List<string> intersectList = cptValuesList1.Intersect(cptValuesList2); . . //now use the snippets abow to mark you interesected values
try to use alogotithm abow with snippets below
//get used range Excel.Range usedRange= WorkSheet.UsedRange; //find cell that match your search value Excel.Range findRange= usedRange.Find(YourSearchValue, missing, Excel.XlFindLookIn.xlValues, Excel.XlLookAt.xlPart, Excel.XlSearchOrder.xlByRows, Excel.XlSearchDirection.xlNext, false, missing, missing); //mark matches Excel.Range firstFind = null; while(findRange!= null) { // Keep track of the first range you find. if (firstFind == null) { firstFind = findRange; } // If you didn't move to a new range, you are done. else if (findRange.get_Address(Excel.XlReferenceStyle.xlA1) == firstFind.get_Address(Excel.XlReferenceStyle.xlA1)) { break; } //Apply color findRange.Font.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red); findRange.Font.Bold = true; findRange = findRange.FindNext(findRange); }
STUFF
FOR XML
hire is Methods to get start and and day from your system. rest do it yourself
"~/Images/" + fileName