Skip to content

Instantly share code, notes, and snippets.

@StevePy
StevePy / PropertyNameExtension.cs
Created Sep 23, 2011
Property Name Extension Method
View PropertyNameExtension.cs
using System;
using System.Linq.Expressions;
public static class PropertyNameExtensions
{
/// <summary>
/// Extension method for exposing the name of properties without resorting to
/// magic strings.
/// Use: objectReference.PropertyName( x => x.{property} ) to retrieve the name.
/// I.e. objectReference.PropertyName( x => x.IsActive ); //will return "IsActive".
@jstangroome
jstangroome / install.ps1
Created Aug 14, 2011
Example Nuget package install script in C#
View install.ps1
param ($InstallPath, $ToolsPath, $Package, $Project)
Add-Type -Language CSharpVersion3 -TypeDefinition @'
public class MyPackage {
public static void Execute(string installPath, string toolsPath, object package, object Project) {
// implement Nuget init, install, uninstall script as C#
System.Console.WriteLine(installPath);
}
}
'@