private static IEnumerator <object> IntYielder(count c, int start, int step) { int prev; for (; ;) { prev = c._curInt; try { start = checked (start + step); } catch (OverflowException) { break; } c._curInt = start; yield return(prev); } BigInteger startBig = (BigInteger)start + step; c._cur = startBig; yield return(prev); for (startBig += step; ; startBig += step) { object prevObj = c._cur; c._cur = startBig; yield return(prevObj); } }
public static count Get() { count count = typePool <count> .Pop() ?? new count(); count.Count = 1; return(count); }
static void Main(string[] args) { List <string> fruits = new List <string> { "apple", "pear", "banana", "strawberry", "lemon" }; transform transform = x => x.ToUpper(); Console.WriteLine("Oefening 1"); foreach (string fruit in fruits) { Console.WriteLine(transform(fruit)); } Console.WriteLine("Oefening 2"); count count = x => x.Length; foreach (string fruit in fruits) { Console.WriteLine($"{fruit} telt {count(fruit)} tekens"); } Console.WriteLine("Oefening 3"); compare compare = (x, y) => x.Length > y.Length; for (int i = 1; i < fruits.Count; i++) { Console.WriteLine($"{fruits[i-1]} contains more characters than {fruits[i]} : {compare(fruits[i-1],fruits[i])}"); } Console.ReadKey(); }
private static IEnumerator <BigInteger> BigIntYielder(count c, BigInteger start, BigInteger step) { for (start += step; ; start += step) { BigInteger prev = (BigInteger)c._cur; c._cur = start; yield return(prev); } }
private static IEnumerator <object> ObjectYielder(PythonContext context, count c, object start, object step) { start = context.Operation(PythonOperationKind.Add, start, step); for (; ; start = context.Operation(PythonOperationKind.Add, start, step)) { object prev = c._cur; c._cur = start; yield return(prev); } }
static void Main(string[] args) { count c = new count(countChars); Console.WriteLine("String 1: "); String a = Console.ReadLine(); Console.WriteLine("String 2: "); String b = Console.ReadLine(); Console.WriteLine(a + " " + b); Console.WriteLine(c(a, b)); }
private static IEnumerator <object> IntYielder(count c, int start, BigInteger step) { BigInteger startBig = (BigInteger)start + step; c._cur = startBig; yield return(start); for (startBig += step; ; startBig += step) { object prevObj = c._cur; c._cur = startBig; yield return(prevObj); } }
static void Main(string[] args) { StudentData sd = new StudentData(); List <Student> students = sd.GetFilteredStudents(); foreach (Student student in students) { Console.WriteLine($"{student.FirstName} {student.LastName}"); } Console.WriteLine(); Console.WriteLine("Oefening 1"); transform transform = x => x.ToUpper(); foreach (string fruit in fruits) { Console.WriteLine(transform(fruit)); } Console.WriteLine(); Console.WriteLine("Oefening 2"); count count = x => x.Length; foreach (string fruit in fruits) { Console.WriteLine($"{fruit} telt {count(fruit)} tekens"); } Console.WriteLine(); Console.WriteLine("Oefening 3"); compare compare = (x, y) => x.Length > y.Length; for (int i = 1; i < fruits.Count; i++) { Console.WriteLine($"{fruits[i - 1]} contains more characters than {fruits[i]} : {compare(fruits[i - 1], fruits[i])}"); } Console.WriteLine(); Console.WriteLine("Oefening 4"); //checkAge checkAge = (x, y) => { if (x < y) return "not"; else return ""; }; checkAge checkAge = (x, y) => (x < y)? "NOT": ""; foreach (Student s in sd.GetAllStudents()) { Console.WriteLine($"{s.FirstName} {s.LastName} is {checkAge(s.Age,21)} old enough."); } Console.ReadKey(); }
public HttpResponseMessage GetLeaveCount(string EID) { try { using (ebuilderEntities entities = new ebuilderEntities()) { var leavesApplied = entities.leavs.Where(l => l.EID == EID && l.date.Year == DateTime.Now.Year); var allLeavesCount = new List <count>(); //Get the accepted leaves only var entity = (from l in leavesApplied join ap in entities.approvals on l.LID equals ap.LID where ap.status == "accepted" select l).ToList(); //get the leave types related to the employee's job category var leaveTypes = (from e in entities.employees join lt in entities.leave_type on e.jobCategory equals lt.jobCategory where e.jobCategory == lt.jobCategory && e.EID == EID select lt).ToList(); foreach (var leaveType in leaveTypes) { count leaveCount = new count(); leaveCount.leaveCategory = leaveType.leaveCategory; foreach (var leave in entity) { if (leave.leaveCategory == leaveType.leaveCategory) { if (leaveType.leaveCategory == "short leave" || leaveType.leaveCategory == "half day") { if (leave.date.Month == DateTime.Now.Month) { leaveCount.takenCount++; } } leaveCount.takenCount++; } } leaveCount.leftCount = leaveType.maxAllowed - leaveCount.takenCount; allLeavesCount.Add(leaveCount); } return(Request.CreateResponse(HttpStatusCode.OK, allLeavesCount)); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }
private void countRun() { //初始化 Image bg_image; Graphics my_graphics; Brush my_brush; Font my_font; bg_image = RSVP7._0.Properties.Resources.bg_gray; my_graphics = Graphics.FromImage(bg_image); m_tmpgr = my_graphics; my_brush = new SolidBrush(Color.Black); my_font = new Font("黑体", 150, FontStyle.Bold); count ct = new count(cdTime); clean cln = new clean(clnNum); string str; //实验开始倒数 for (int i = 5; i >= 1; i--) { str = i.ToString(); this.Invoke(ct, new object[] { str, bg_image, my_graphics, my_brush, my_font }); Thread.Sleep(1000); this.Invoke(cln, new object[] { my_graphics }); } if (thr == null) { if (Config.m_auditory != 0) { this.Invoke(ct, new object[] { "+", bg_image, my_graphics, my_brush, my_font }); } thr = new Thread(new ThreadStart(thrRun)); thr.Start(); } }
public static (IAsyncObserver <TSource>, IAsyncDisposable) Window <TSource>(IAsyncObserver <IAsyncObservable <TSource> > observer, IAsyncDisposable subscription, int count) => Window(observer, subscription, count, count);
return(new BulletGroupInfo(count, orig.SpawnCount));
SearchTypes.trending => await Client.TrendingAsync(count, NextGifs),
this.Semaphore = new SemaphoreSlim(count, count);
public ActionResult Login(user user, string password, string remember) { try { user userDetail = db.user.Where(x => x.Mail == user.Mail && x.Password == user.Password).FirstOrDefault(); // TODO: Add insert logic here if (userDetail != null) { userDetail.Password = "******"; } if (userDetail == null) { TempData["AlertMessage"] = "User not found"; return(RedirectToAction("Index")); } if (userDetail.Status == 1) { count count = db.count.Where(x => x.iduser == userDetail.idUsers).FirstOrDefault(); if (count == null) { count newcount = new count(); string str = "INSERT INTO `webshop`.`count` (`iduser`, `count`) VALUES ('" + userDetail.idUsers + "', '1');"; db.Database.ExecuteSqlCommand(str); } else { count.count1++; string str = "UPDATE `webshop`.`count` SET `count` = '" + count.count1 + "' WHERE (`iduser` = '" + userDetail.idUsers + "');"; db.Database.ExecuteSqlCommand(str); } int users = db.user.ToList().Count - 1; int visitedbyme = db.count.Where(x => x.iduser == userDetail.idUsers).First().count1; int visit = 0; List <count> lvisit = db.count.ToList(); foreach (var item in lvisit) { visit += item.count1; } DateTime now = DateTime.Now; HttpCookie ck = new HttpCookie("counter"); ck.Expires.AddYears(30); ck.Values.Add("visit", visit.ToString()); ck.Values.Add("visitedbyme", visitedbyme.ToString()); ck.Values.Add("users", users.ToString()); Response.Cookies.Add(ck); TempData["AlertMessage"] = "Welcome " + user.Name; Session["User"] = userDetail; Remember(remember); return(Redirect("/User")); } else if (userDetail.Status == 999) { Session["User"] = userDetail; Remember(remember); return(Redirect("/Admin")); } else { TempData["AlertMessage"] = "The User Is Disabled. Wait until Admins Enable Your Account."; return(RedirectToAction("Index")); } } catch { return(View()); } }
static void Main(string[] args) { count numero = new count(); morse morseC = new morse(); caesar caesarC = new caesar(); rsa rsa = new rsa(); faza3 f3= new faza3(); if (args[0] == "1") { Environment.Exit(-1); } else if (args[1] == "2") { if (args[2] == "1") { Console.WriteLine("numri i charactereve : " + numero.countCh(args[0])); } else if (args[2] == "2") { Console.WriteLine("numri i rreshtave : " + numero.countLi(args[0])); } else if (args[2] == "3") { Console.WriteLine("numri i fjaleve : " + numero.countW(args[0])); } else if (args[2] == "4") { Console.WriteLine("numri i fjalive : " + numero.countWo(args[0])); } else if (args[2] == "5") { Console.WriteLine("numri i zanoreve : " + numero.countZan(args[0])); } else if (args[2] == "6") { Console.WriteLine("numri i bashtingelloreve : " + numero.countBash(args[0])); } else if(args[2]=="7") {Console.WriteLine("numri i simboleve : " + numero.countSymb(args[0]));} else { Console.WriteLine("Wrong input !!!"); } } else if (args[1] == "3") { char[] ar = args[0].ToCharArray(); string emri = "", VP = ""; if (args[2] == "1") { for (int i = 0; i < ar.Length; i++) { emri = emri + morseC.morseEnco(ar[i]);//encode if (ar[i] == ' ') { } else { Console.Beep(); } Console.Write(morseC.morseEnco(ar[i])); } Console.WriteLine("\n"); } else if (args[2] == "2") { for (int i = 0; i < ar.Length; i++)//decode { VP = VP + ar[i]; if (ar[i] == ' ') { emri = emri + morseC.morseDeco(VP); VP = ""; } } Console.WriteLine(emri); } else { Console.WriteLine("Wrong input !!!"); } } else if (args[1] == "4") { if (args[2] == "1") { int k = Convert.ToInt32(args[3]); Console.WriteLine("ciphertext : " + caesarC.caesarCipherEnco(args[0], k)); } else if (args[2] == "2") { int k = Convert.ToInt32(args[3]); Console.WriteLine("plaintext : " + caesarC.caesarCipherDeco(args[0], k)); } else if(args[2]=="3") {caesarC.bruteForce(args[0]);} else { Console.WriteLine("Wrong input !!!"); } } else if (args[0] == "create-user") { rsa.createUser(args[1]); } else if (args[0] == "delete-user") { rsa.deleteUser(args[1]); } else if (args[0] == "import-key") { rsa.importKey(args[1], args[2]); } else if (args[0] == "export-key") { rsa.exportKey(args[1], args[2]); } else if (args[0] == "write-text") { rsa.writeText(args[1], args[2],args[3],args[4]); } else if (args[0] == "read-text") { rsa.readText(args[1],args[2]); } else if (args[0] == "login") { f3.Login(args[1]); } else if (args[0] == "status") { Console.WriteLine(f3.status(args[1])); } else { Console.WriteLine("Wrong input !!!"); } Console.ReadKey(); }
/// <summary> /// Sends copy of buffer non-blocking with <see cref="SocketFlags.None"/> /// </summary> /// <returns>Returns false if send fails, else returns true with number of sent bytes</returns> protected (bool, int) SendNonBlocking(byte[] buffer, int offset, int count) => SendNonBlocking(buffer, offset, count, SocketFlags.None);
private static IEnumerator<object> IntYielder(count c, int start, int step) { int prev; for (; ; ) { prev = c._curInt; try { start = checked(start + step); } catch (OverflowException) { break; } c._curInt = start; yield return prev; } BigInteger startBig = (BigInteger)start + step; c._cur = startBig; yield return prev; for (startBig += step; ; startBig += step) { object prevObj = c._cur; c._cur = startBig; yield return prevObj; } }
get => new Quantity(count: _quantityCount, unit: _quantityUnit);
var(count, items) = cmd.GetWhere <T> (predicate: null);
set => Set(ref count, value);
get => new Quantity(count: _servingSizeCount, unit: _servingSizeUnit);
var(count, s1, s2, s3, s4) = this.GetCounts(x.Key.AssignedToFullName);
/// <summary>Gets the string for the specified 7Bit ASCII bytes.</summary> /// <param name="bytes">Bytes to decode.</param> /// <param name="start">Startindex at the array to decode.</param> /// <param name="count">Length in bytes to decode.</param> /// <param name="termination">if set to <c>true</c> [obey termination].</param> /// <returns>The string.</returns> /// <exception cref="ArgumentNullException">bytes.</exception> /// <exception cref="InvalidDataException">Byte '{0}' at index '{1}' is not a valid ASCII character!.</exception> public static string GetString(byte[] bytes, int start, int count, bool termination = false) => new(GetChars(bytes, start, count, termination));
private static IEnumerator<object> IntYielder(count c, int start, BigInteger step) { BigInteger startBig = (BigInteger)start + step; c._cur = startBig; yield return start; for (startBig += step; ; startBig += step) { object prevObj = c._cur; c._cur = startBig; yield return prevObj; } }
GenerateGroupData(count, format, streamWriter);
private static IEnumerator<BigInteger> BigIntYielder(count c, BigInteger start, BigInteger step) { for (start += step; ; start += step) { BigInteger prev = (BigInteger)c._cur; c._cur = start; yield return prev; } }
var(preparation, measure, count, samples) = _args;
private static IEnumerator<object> ObjectYielder(PythonContext context, count c, object start, object step) { start = context.Operation(PythonOperationKind.Add, start, step); for (; ; start = context.Operation(PythonOperationKind.Add, start, step)) { object prev = c._cur; c._cur = start; yield return prev; } }
SearchTypes.getGifs => await Client.GetGifsAsync(count, NextGifs, Ids),
Paginator = new Paginator(count: await countTask, pageNum: PageNum, link: "/OwnPosts?pageNum=1", topicId: null);
select(count, bag);
Paginator = new Paginator(count: topicList.Count(), pageNum: PageNum, link: "/NewPosts?pageNum=1", topicId: null);