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
private static IEnumerable<int> ZipWith(Func<int, int, int> combinePair, | |
IEnumerable<int> listA, | |
IEnumerable<int> listB) | |
{ | |
return listA.Zip(listB, combinePair); | |
} | |
private static IEnumerable<int> Tail(IEnumerable<int> list) | |
{ | |
return list.Skip(1); |
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
[DebuggerDisplay("{DebuggerDisplay,nq}")] | |
public class Example | |
{ | |
public Example(string a, string b) | |
{ | |
PropertyA = a; | |
PropertyB = b; | |
} | |
public string PropertyA { get; private set; } |
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
#!/bin/sh | |
#Usage: | |
# ./migrate_hg_to_git LocalRepoFolderName HgSourceRepoUrl GitDestinationUrl | |
# | |
# For example: | |
# ./migrate_hg_to_git MyProject https://bitbucket.org/Example/myproject [email protected]:Example/MyProject.git | |
# | |
# The git destination URL should be a new, empty repository for which you have push rights. | |
# |
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
var delayedGreetings = new List<Func<string>>(); | |
foreach (var name in new[] { "Larry", "Moe", "Curly" }) | |
delayedGreetings.Add(() => "Hello, " + name + "!"); | |
//Some time later... | |
foreach (var greeting in delayedGreetings) | |
Console.WriteLine(greeting()); |
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
foreach (var name in new[] { "Larry", "Moe", "Curly" }) | |
{ | |
string name1 = name; //Added a seemingly-pointless local variable! | |
delayedGreetings.Add(() => "Hello, " + name1 + "!"); | |
} | |
//Some time later... | |
foreach (var greeting in delayedGreetings) | |
Console.WriteLine(greeting()); |
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
var delayedGreetings = new List<Func<string>>(); | |
{ | |
using (var e = ((IEnumerable<string>)new[] { "Larry", "Moe", "Curly" }).GetEnumerator()) | |
{ | |
string name; | |
while (e.MoveNext()) | |
{ | |
name = e.Current; | |
delayedGreetings.Add(() => "Hello, " + name + "!"); |
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
public class Environment | |
{ | |
public string name; | |
//As well as one field for each of the | |
//original loop's local variables, if | |
//there were any... | |
} | |
public class Greeter | |
{ |
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
var delayedGreetings = new List<Func<string>>(); | |
{ | |
using (var e = ((IEnumerable<string>)new[] { "Larry", "Moe", "Curly" }).GetEnumerator()) | |
{ | |
while (e.MoveNext()) | |
{ | |
string name = e.Current; //Variable declaration inside the while. | |
delayedGreetings.Add(() => "Hello, " + name + "!"); | |
} |
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
<?xml version="1.0"?> | |
<package> | |
<metadata> | |
<id>Enumeration</id> | |
<version>1.0.4</version> | |
<authors>Headspring</authors> | |
<owners>Headspring</owners> | |
<licenseUrl>https://github.com/HeadspringLabs/Enumeration/blob/master/content/Headspring/LICENSE.txt</licenseUrl> | |
<projectUrl>https://github.com/HeadspringLabs/Enumeration</projectUrl> | |
<iconUrl>https://bitbucket-assetroot.s3.amazonaws.com/c/photos/2010/May/14/spray_avatar.png</iconUrl> |
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
<files> | |
<file src="Enumeration.cs" target="content\Headspring\Enumeration.cs" /> | |
<file src="LICENSE.txt" target="content\Headspring\LICENSE.txt" /> | |
</files> |