¡@

Home 

c# Programming Glossary: enumerable.range

Order of LINQ extension methods does not affect performance?

http://stackoverflow.com/questions/10110013/order-of-linq-extension-methods-does-not-affect-performance

x x.Text.Contains 10000 var hugeList Enumerable.Range 1 50000000 .Select i new ID i Text Item i var sw1 new System.Diagnostics.Stopwatch..

Excel interop: _Worksheet or Worksheet?

http://stackoverflow.com/questions/1051464/excel-interop-worksheet-or-worksheet

workSheet.Cells 1 20 workSheet.get_Range start end .Value2 Enumerable.Range 1 20 .ToArray I'm trying to avoid doing a full deep dive..

await vs Task.Wait - Deadlock?

http://stackoverflow.com/questions/13140523/await-vs-task-wait-deadlock

GET api test public IEnumerable string Get Task.WaitAll Enumerable.Range 0 10 .Select x Ros .ToArray return new string value1 value2..

How can I obtain all the possible combination of a subset?

http://stackoverflow.com/questions/13765699/how-can-i-obtain-all-the-possible-combination-of-a-subset

wiki feel free to update it. void PerfTest var list Enumerable.Range 0 21 .ToList var t1 GetDurationInMs list.SubSets_LB var t2 GetDurationInMs..

Splitting a string into chunks of a certain size

http://stackoverflow.com/questions/1450774/splitting-a-string-into-chunks-of-a-certain-size

IEnumerable string Split string str int chunkSize return Enumerable.Range 0 str.Length chunkSize .Select i str.Substring i chunkSize chunkSize..

Program to find prime numbers

http://stackoverflow.com/questions/1510124/program-to-find-prime-numbers

optimal trial division sieve in one long line like this Enumerable.Range 0 Math.Floor 2.52 Math.Sqrt num Math.Log num .Aggregate Enumerable.Range.. 0 Math.Floor 2.52 Math.Sqrt num Math.Log num .Aggregate Enumerable.Range 2 num 1 .ToList result index var bp result index var sqr bp..

How to remove elements from a generic list while iterating over it?

http://stackoverflow.com/questions/1582285/how-to-remove-elements-from-a-generic-list-while-iterating-over-it

safePendingList.RemoveAt i Example var list new List int Enumerable.Range 1 10 for int i list.Count 1 i 0 i if list i 5 list.RemoveAt.. a simplified example to demonstrate var list new List int Enumerable.Range 1 10 Console.WriteLine Before list.ForEach i Console.WriteLine..

Implementing a log viewer with WPF

http://stackoverflow.com/questions/16743804/implementing-a-log-viewer-with-wpf

DataContext LogEntries new ObservableCollection LogEntry Enumerable.Range 0 200000 .ToList .ForEach x LogEntries.Add GetRandomEntry.. Index index DateTime DateTime.Now Message string.Join Enumerable.Range 5 random.Next 10 50 .Select x words random.Next 0 maxword.. Index index DateTime DateTime.Now Message string.Join Enumerable.Range 5 random.Next 10 50 .Select x words random.Next 0 maxword..

Randomize a List<T> in C#

http://stackoverflow.com/questions/273313/randomize-a-listt-in-c-sharp

static void Main string args var numbers new List int Enumerable.Range 1 75 numbers.Shuffle Console.WriteLine The winning numbers are..

Convert hex string to byte array [duplicate]

http://stackoverflow.com/questions/321370/convert-hex-string-to-byte-array

public static byte StringToByteArray string hex return Enumerable.Range 0 hex.Length .Where x x 2 0 .Select x Convert.ToByte hex.Substring..

Easiest way to create a cascade dropdown in ASP.NET MVC 3 with C#

http://stackoverflow.com/questions/5497524/easiest-way-to-create-a-cascade-dropdown-in-asp-net-mvc-3-with-c-sharp

set public IEnumerable SelectListItem Years get return Enumerable.Range 2000 12 .Select x new SelectListItem Value x.ToString Text.. ActionResult Months int year if year 2011 return Json Enumerable.Range 1 3 .Select x new value x text x JsonRequestBehavior.AllowGet.. value x text x JsonRequestBehavior.AllowGet return Json Enumerable.Range 1 12 .Select x new value x text x JsonRequestBehavior.AllowGet..

Combination Generator in Linq

http://stackoverflow.com/questions/774457/combination-generator-in-linq

you can use range to do things like List char letterRange Enumerable.Range 'a' 'z' 'a' 1 .Select i Char i .ToList 97 122 1 26 letters iterations..

Is it possible to dynamically compile and execute C# code fragments?

http://stackoverflow.com/questions/826398/is-it-possible-to-dynamically-compile-and-execute-c-sharp-code-fragments

public static void Main string args var q from i in Enumerable.Range 1 100 where i 2 0 select i results.Errors.Cast CompilerError..