berserk.org

berserk.org header image

And that’s a wrap.

November 16th, 2005 · No Comments

You’d want to do more than just cycle through the keys in the core method of course, and I do but I’ve cut that bit out and just left the juicy bits.

I’m a big fan of wrapping.

public string GetFullNameForFoo() {
    return GetFooData( new string [] {"firstName", "lastName"} );
}

public string GetUserNameForFoo() {
    return GetFooData( new string [] {"userName"} );
}

private string GetFooData( string [] keys ) {
    foreach ( string k in keys ){
        retVal += r[ k ] + " ";
    }
    return retVal;
}

Tags: code