Skip to content

Instantly share code, notes, and snippets.

View josephwoodward's full-sized avatar

Joseph Woodward josephwoodward

View GitHub Profile
public static void ParseMyCode(string code)
{
var sourceLanguage = new CSharpLanguage();
SyntaxTree syntaxTree = sourceLanguage.ParseText(code, SourceCodeKind.Regular);
}
.class private auto ansi '<Module>'
{
} // end of class <Module>
.class public auto ansi beforefieldinit C
extends [mscorlib]System.Object
{
// Methods
.method public hidebysig
instance void M () cil managed
// 1: Object Initializer //////////////////////////////////
public class User {
public bool IsActive { get; set; }
public string Name { get; set; }
}
var user = new User {
ActionsToBuildUp = () => true;
ActionsToBuildUp += () => false;
bool result = ActionsToBuildUp(); // returns false
@josephwoodward
josephwoodward / WriteToSection.cs
Last active August 29, 2015 14:25
Write to section in ASP.NET MVC
public static IHtmlString PageHeading(this HtmlHelper html, Icon icon, string title, string subTitle)
{
WebViewPage page = html.ViewDataContainer as WebViewPage;
if (page != null)
{
page.DefineSection("Heading", () => {
page.Write(MvcHtmlString.Create("My Text"));
});
}
<tbody>
<tr>
<td rowspan="4">
<select>
skip, remap etc.
</select>
</td>
</tr>
<tr id=skip>
using System;
using System.Linq.Expressions;
namespace ExpressionDemo2
{
internal class Program
{
private static void Main(string[] args)
{
internal class Program
{
private static void Main(string[] args)
{
var myClass = new ExpressionTest();
// Ambig.
myClass.TestMethod(myExpression1:x => x.ToString());