Skip to content

Instantly share code, notes, and snippets.

@esride-apf
Created December 28, 2011 17:15
Show Gist options
  • Save esride-apf/1528745 to your computer and use it in GitHub Desktop.
Save esride-apf/1528745 to your computer and use it in GitHub Desktop.
LINQPad Samples
void Main()
{
var listOfI = GetInts();
foreach (var i in listOfI)
{
Console.WriteLine(i);
}
Console.WriteLine("******");
Console.WriteLine("jetzt 1-stellige");
var einstellige = from i in listOfI where i < 10 select i;
foreach (var i in einstellige)
{
Console.WriteLine(i);
}
Console.WriteLine("******");
Console.WriteLine("jetzt 2-stellige");
var zweistellige = listOfI.Where(i => i >= 10);
foreach (var i in zweistellige)
{
Console.WriteLine(i);
}
Console.WriteLine("******");
Console.WriteLine("und nochmal alle");
listOfI.ToList().ForEach(i => Console.WriteLine(i));
}
// Define other methods and classes here
public IEnumerable<int> GetInts()
{
Console.WriteLine("Start yielding");
yield return 1;
yield return 2;
yield return 11;
yield return 12;
Console.WriteLine("End yielding");
}
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName= "notepad.exe";
proc.Start();
proc.WaitForExit();
Console.WriteLine("Habe fertig");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment