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; | |
interface IContainer | |
{ | |
object Obj { set; } | |
} | |
struct P : IContainer | |
{ | |
public object Obj { set { this.o = value; } } | |
object o; |
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
var x = /°+/ |
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
type A private() = | |
[<DefaultValue>] | |
val mutable x: string | |
new(x : string) = | |
if x = null then nullArg "x" | |
A() | |
then | |
printfn "x=%s" x | |
type B(x : string) = |
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
type A() = | |
[<DefaultValue>] | |
val mutable x: string | |
new(x : string) = | |
if x = null then nullArg "x" | |
A() | |
then | |
printfn "x=%s" x | |
type B(x : string) = |
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
type A = | |
val x: string | |
new(x : string) = | |
if x = null then nullArg "x" | |
{x = x} | |
then | |
printfn "x=%s" x |
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 Program | |
{ | |
static void Main(string[] args) | |
{ | |
Run().Wait(); | |
} | |
static async Task Run() | |
{ | |
var tcs = new TaskCompletionSource<object>(); |
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
// add reference to System.DirectoryServices.AccountManagement.dll | |
var sidAttr = pool.Attributes["applicationPoolSid"]; | |
var securityIdentifier = new SecurityIdentifier((string)sidAttr.Value); | |
using(var ctx = new PrincipalContext(ContextType.Machine)) | |
using(var group = GroupPrincipal.FindByIdentity(ctx, IdentityType.Sid, (string)securityIdentifier.Value)) | |
{ | |
Debug.Assert(group != null); | |
} |
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
let rec findPivot (myArray : int[]) i = | |
if i = 0 then | |
-1 | |
else | |
System.Diagnostics.Trace.Assert false | |
if myArray.[i] > myArray.[i-1] then i - 1 | |
else findPivot myArray (i - 1) | |
findPivot [| 1; 2; 3; 4 |] 3 |
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
// have no idea what exact type should look like | |
type Node = { Reference : int } | |
let mkArgs0 (target : Node) (source : Node) = dict ["n", box target.Reference; "m", box source.Reference] | |
// symbolic operators FTW | |
let (=>) (a : string) b = a, box b | |
let mkArgs1_1 (target : Node) (source : Node) = dict ["n" => target.Reference; "m" => source.Reference] | |
let (!) = box |
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 IEnumerable<Row> Execute(IEnumerable<Row> rows) | |
{ | |
var blockingCollection = new BlockingCollection<Row>(); | |
var count = _operations.Count; | |
if (count == 0) | |
{ | |
yield break; | |
} | |
var tasks = _operations.Select(currentOp => | |
Task.Factory.StartNew(() => |
NewerOlder