Skip to content

Instantly share code, notes, and snippets.

View jbevain's full-sized avatar

Jb Evain jbevain

View GitHub Profile
@jbevain
jbevain / MethodBaseRocks.cs
Created April 29, 2009 19:37
A reflection based disassembler
View MethodBaseRocks.cs
//
// MethodBaseRocks.cs
//
// Author:
// Jb Evain (jbevain@novell.com)
//
// WARNING: code now lives in http://github.com/jbevain/mono.reflection
//
// (C) 2009 Novell, Inc. (http://www.novell.com)
//
@jbevain
jbevain / BackingFieldResolver.cs
Created April 29, 2009 19:42
Code to resolve a property's backing field.
View BackingFieldResolver.cs
//
// BackingFieldResolver.cs
//
// Author:
// Jb Evain (jbevain@novell.com)
//
// WARNING: code now lives in http://github.com/jbevain/mono.reflection
//
// (C) 2009 Novell, Inc. (http://www.novell.com)
//
@jbevain
jbevain / rx-rebase.cs
Created July 30, 2009 10:22
Tool to rebase System.Reactive to the .net framework
View rx-rebase.cs
using System;
using System.Globalization;
using System.Linq;
using Mono.Cecil;
class Rebase {
static void Main ()
{
@jbevain
jbevain / test-rx.cs
Created July 30, 2009 10:23
A test program to use the RX framework on the .net framework
View test-rx.cs
using System;
using System.Collections.Generic;
using System.Linq;
// from http://themechanicalbride.blogspot.com/2009/07/introducing-rx-linq-to-events.html
class Program {
static void Main ()
{
@jbevain
jbevain / gist:199666
Created October 2, 2009 11:10
A tool to rewrite generic constraints for enums and delegates
View gist:199666
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using SR = System.Reflection;
using Mono.Cecil;
class Program {
@jbevain
jbevain / Image.cs
Created December 8, 2009 16:38
A class to test whether a file is a PE file and a managed assembly
View Image.cs
//
// Image.cs
//
// Author:
// Jb Evain (jbevain@novell.com)
//
// WARNING: code now lives in http://github.com/jbevain/mono.reflection
//
// (C) 2009 Novell, Inc. (http://www.novell.com)
//
@jbevain
jbevain / gist:377904
Created April 24, 2010 20:00
A half working patch to support iterators
View gist:377904
diff --git a/Mono.Cecil.Cil/MethodBody.cs b/Mono.Cecil.Cil/MethodBody.cs
index 6f818fe..bce81b4 100644
--- a/Mono.Cecil.Cil/MethodBody.cs
+++ b/Mono.Cecil.Cil/MethodBody.cs
@@ -46,6 +46,7 @@ namespace Mono.Cecil.Cil {
internal Collection<ExceptionHandler> exceptions;
internal Collection<VariableDefinition> variables;
Scope scope;
+ TypeDefinition iterator_type;
@jbevain
jbevain / of-rewrite.cs
Created May 5, 2010 15:08
A rewriter to support methodof and fieldof operations
View of-rewrite.cs
using System;
using System.Collections.Generic;
using System.Linq;
using Mono.Cecil;
using Mono.Cecil.Cil;
class MethodProcessor {
readonly MethodBody body;
View tilde.diff
diff --git a/mcs/mcs/cs-parser.jay b/mcs/mcs/cs-parser.jay
index b718931..70051f1 100644
--- a/mcs/mcs/cs-parser.jay
+++ b/mcs/mcs/cs-parser.jay
@@ -2705,6 +2705,22 @@ delegate_declaration
}
;
+opt_enumerable_or_nullable
+ : opt_enumerable
@jbevain
jbevain / gist:647076
Created October 26, 2010 15:14
Node dumper using y combinator
View gist:647076
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Node {
public string Text { get; private set; }
public IList<Node> Children { get; private set; }