Casting functions -- Is it a code smell?

Posted by Earlz on Stack Overflow See other posts from Stack Overflow or by Earlz
Published on 2010-05-17T17:37:32Z Indexed on 2010/05/17 17:40 UTC
Read the original article Hit count: 439

I recently began to start using functions to make casting easier on my fingers for one instance I had something like this

((Dictionary<string,string>)value).Add(foo);

and converted it to a tiny little helper function so I can do this

ToDictionary(value).Add(foo);

Is this a code smell?

(also I've marked this language agnostic even though my example is C#)

© Stack Overflow or respective owner

Related posts about code-smell

Related posts about best-practices