static void Main(string[] args) { //Utwórz funkcję lambda (int) => (int) która zwraca ile razy wykona się następująca pętla: jeżeli a jest parzyste - podziel przez 2, jeżeli nieparzyste - pomnóż przez 3 i dodaj 1. Func <int, int> lambda = (a) => { int counter = 0; while (a != 1) { if (a % 2 == 0) { a = a / 2; } else { a = 3 * a + 1; } counter++; } return(counter); }; //Utwórz funkcję lambda (string, bool) => (string), która ucina pierwszą literę albo ostatnią w zależności od wartości parametru logicznego. Func <string, bool> lamb = (string a) => { bool prawda; if (prawda) { a.Substring(0); } else { a.Substring(a.Length); } return(a); }; Delegator1[] del1 = new Delegator1[5]; del1[0] = (s) => { return(s + s + s); }; del1[1] = (s) => { string wynik = ""; wynik = s.Substring(0, 3); return(wynik); }; for (int i = 0; i < 2; i++) { Console.WriteLine(del1[i]("miś")); } Delegator del; del = Mnozenie; /* * Console.Write(del(5, 3)); * Console.WriteLine(Test(3, 5, del)); */ }
/// <summary> /// Customize the fields you're interested, select the page you want to navigate to, the form will be edit automatically according to your profile /// /// TO DO ********* OPTION TO SEND PRO /// </summary> /// <param name="backofficeDriver"></param> /// <param name="Fields"></param> /// <param name="pageToNavigate"></param> public static void CustomizeToForm(RemoteWebDriver backofficeDriver, string[] Fields, Delegator1 pageToNavigate) { pageToNavigate(backofficeDriver: backofficeDriver); EditBOForm(backofficeDriver); foreach (var item in Fields) { backofficeDriver.FindElement(By.Id("txtSearchBankFields")).SendKeys(item); SafeClick(backofficeDriver, string.Format("//span[@class='fl' and contains(.,'{0}')]//following-sibling::div", item)); backofficeDriver.FindElement(By.Id("txtSearchBankFields")).Clear(); SafeClick(backofficeDriver, "//div[3]/div/div//span[@class='fa fa-search']"); Thread.Sleep(1000); } SafeClick(backofficeDriver, "//div[contains(text(),'Save')]"); }