jump to navigation

Request For Comment: NomNom May 15, 2008

Posted by Brent in technology, what "you do here".
Tags: , , , , ,
add a comment

using System;

namespace Silly
{
/// <summary>
/// Wrapper to facilitate the nom-nom-nom anti-pattern
/// </summary>
/// <typeparam name=”T”></typeparam>
public static class NomNom<T>
{
public static void Nom<WTF>(Func<WTF> action)
{
try { action(); }
catch { } // this is the om nom nom nom pattern
}

public static void Nom<WTF>(Action<WTF> action, WTF input)
{
try { action(input); }
catch { }
}
}
}

private static void TestSilly()
{
NomNom<int>.Nom<int>(OMGBOOMZ(), -1);
}

private static Action<int> OMGBOOMZ()
{
return x => { –x; List<int> xx = new List<int>(); xx[x]++; };
}

Advertisements

Ask Everyone: Where’s your Constructor? April 11, 2008

Posted by Brent in computers.
Tags: , ,
1 comment so far

Where do you prefer to put your object’s constructor in relation to the file’s line numbers?

Near the top?  Before or after the member object declarations?

——————

I prefer to keep them near the top, preferably after the private member declarations.  It’s not a hard or fast rule for me, but I dislike it when the constructor(s) is/off mingling with other methods in the middle of the class.