Make your own code candy in C#.

Pseudo candy

public void DoSomething(action myAction)
catch {
//Do some special handling


var _a = “a;”
DoSomething(new {o} ->{
//Do something to invoke.


As you can see, we can use the action delegate to create a method wrapper to do something complex and hide its inner working.

However, this doesn’t make trouble shooting any easier. Nor does it make your code magicly better. You still need to make sure your code is as bullet proof as possible.

Without the code candy-ish-ness.

private someThing(string A)
//<==Move error handling here.
//Do something to invoke.

var _a = “a;”


Your funtions are now more specific to what you need. There is less room for code abuse.

Closing statement

Though I don’t look down on using the pseudo code candy, I strongly suggest that if you use it in a team environment, you don’t abuse it.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.