This file contains 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
^(?'xmlDecl'<\?xml(?'versionInfo'([\u0020\u0009\u000d\u000a]+)version(?'eq'([\u0 | |
020\u0009\u000d\u000a]+)?=([\u0020\u0009\u000d\u000a]+)?)('1\.[0-9]+'|"1\.[0-9]+ | |
"))(?'encodingDecl'([\u0020\u0009\u000d\u000a]+)encoding(?'eq'([\u0020\u0009\u00 | |
0d\u000a]+)?=([\u0020\u0009\u000d\u000a]+)?)("(?'encName'[A-Za-z][A-Za-z0-9._-]* | |
)"|'(?'encName'[A-Za-z][A-Za-z0-9._-]*)'))?(?'sddecl'([\u0020\u0009\u000d\u000a] | |
+)standalone(?'eq'([\u0020\u0009\u000d\u000a]+)?=([\u0020\u0009\u000d\u000a]+)?) | |
("(yes|no)"|'(yes|no)'))?([\u0020\u0009\u000d\u000a]+)?\?>)?(?'misc'(?'comment'< | |
!--((?!--)([\u0009\u000a\u000d\u0020-\ud7ff\ue000-\ufffd]|([\ud800-\udbff][\udc0 | |
0-\udfff])))*-->)|(?'PI'<\?(?'pitarget'(?![xX][mM][lL])(?'name'([:A-Z_a-z\u00C0- | |
\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u |
This file contains 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
operator implicit |
This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace Lens | |
{ | |
class Program | |
{ | |
class Foo | |
{ |
This file contains 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 Task Write(ArraySegment<byte> buffer) | |
{ | |
unsafe | |
{ | |
fixed (byte* thing = buffer.Array) // this fixed expires but the real fixed is that done by Pack (lives until callback) | |
{ | |
var tcs = new TaskCompletionSource<uint>(); | |
var overlapped = new Overlapped((int)_pos, (int)(_pos>>32), IntPtr.Zero, null); | |
_pos += (ulong)buffer.Count; |
This file contains 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
using System; | |
using System.Linq; | |
class Program | |
{ | |
static void Main() | |
{ | |
var s = "hello"; |
This file contains 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
using System; | |
// Mu-Torere | |
// in terrible C# | |
// transcribed from: http://www.atariarchives.org/bigcomputergames/showpage.php?page=43 (and following) | |
class MuTorere | |
{ | |
static int[] H; | |
static int[] A; |
This file contains 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
class Example | |
{ | |
// "init-anywhere" syntax (along the lines of Haskell) | |
[Implemented(true)] | |
Foo Do() | |
{ | |
var x = new Foo { bar = 1 }; // <- currently available | |
return x { bar = 3 }; // <- proposed (note that this mutates unlike Haskell) | |
} | |
This file contains 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.Tuple`2[System.Int32,System.Int32] | |
System.Tuple`1[System.Int32] | |
hello, foo: 2 - (1, 2), (1), (1, hello) | |
4294967295 |
This file contains 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
static bool TryParseEnum<T>(string input, out T parsedValue) | |
{ | |
input = input.Trim(); | |
foreach (T value in Enum.GetValues(typeof(T))) | |
{ | |
if (value.ToString() == input) | |
{ | |
parsedValue = value; | |
return true; | |
} |
This file contains 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
template <class PtrType, PtrType> | |
// e.g. this could be "template<class PtrType, PtrType second>" | |
// the second arg has the type of the first argument, but isn't a type itself | |
struct eq {}; | |
struct Foo | |
{ | |
int val() { return -31; } | |
}; |