-
-
Save stephensmitchell/2738e30c125dc8f34d8eae6a7367bed9 to your computer and use it in GitHub Desktop.
LINQPad Samples #LINQPad
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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