Skip to content

Instantly share code, notes, and snippets.

@StevePy
StevePy / TaxCalculator.cs
Created September 23, 2011 13:17
Ayende's Tax Thing
public class TaxCalculator
{
private static readonly IList<TaxBracket> TaxBrackets;
static TaxCalculator()
{
TaxBrackets = setupTaxBrackets();
}
public decimal CalculateTax( decimal grossIncome )
@StevePy
StevePy / PropertyNameExtension.cs
Created September 23, 2011 15:08
Property Name Extension Method
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".
@StevePy
StevePy / SettingsExtensions.cs
Created October 12, 2011 11:12
Settings Refresh Extension
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Configuration;
using System.Diagnostics;
namespace Spynical.Settings
{
/// <summary>