Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,3 @@
int GetNumber() {
return 5;
}

View file

@ -0,0 +1,10 @@
try {
if (someCondition) {
throw new Exception();
}
} catch (Exception ex) {
LogException(ex);
throw;
} finally {
cleanUp();
}

View file

@ -0,0 +1,13 @@
public static void Main() {
foreach (int n in Numbers(i => i >= 2) {
Console.WriteLine("Got " + n);
}
}
IEnumerable<int> Numbers(Func<int, bool> predicate) {
for (int i = 0; ; i++) {
if (predicate(i)) yield break;
Console.WriteLine("Yielding " + i);
yield return i;
}
}

View file

@ -0,0 +1,5 @@
async Task DoStuffAsync() {
DoSomething();
await someOtherTask;//returns control to caller if someOtherTask is not yet finished.
DoSomethingElse();
}

View file

@ -0,0 +1,7 @@
while (conditionA) {
for (int i = 0; i < 10; i++) {
if (conditionB) goto NextSection;
DoSomething(i);
}
}
NextSection: DoOtherStuff();