Skip to content

Instantly share code, notes, and snippets.

//Discovering all method declarations in a given tree:
IEnumerable<MethodDeclarationSyntax> methods =
tree.Root
.DescendentNodes()
.OfType<MethodDeclarationSyntax>().ToList();
public static Customer GetCustomer(Guid customerID)
{
try
{
return CustomerDataAccess.GetCustomer(customerID);
}
catch (Exception ex)
{
Handle(ex);
}
public static Customer GetCustomer(Guid customerID)
{
try
{
return CustomerDataAccess.GetCustomer(customerID);
}
catch (Exception ex)
{
Handle(ex);
}
public static Customer GetCustomer(Guid customerID)
{
try
{
return CustomerDataAccess.GetCustomer(customerID);
}
catch (SomeSpecialException)
{
throw;
}
public static Customer GetCustomer(Guid customerID)
{
return CustomerDataAccess.GetCustomer(customerID);
}
using Some.Imaginary.Macro.Library;
public class Sample
{
prop public string Name;
}
public class Sample
{
private string _name;
public string Name
{
get { return _name; }
set { _name = value; }
}
}
using Some.Imaginary.Macro.Library;
public class Sample
{
prop public string Name;
}
public static int DoSomething(int x, int y)
{
if (x > 0)
return x;
return y;
}
public static int DoSomethingLazily(Func<int> x, Func<int> y)
{
fibs = 0 : 1 : zipWith (+) fibs (tail fibs)