Possible Duplicate:
C# - Is there a better alternative than this to ‘switch on type’?
My company legacy code has something as follow
public override Uri GetUri(object obj)
{
if ((obj is Entry) || (obj is EntryComment))
{
//
}
if (obj is Blog)
{
//
}
// if obj is blah blah blah
}
This method is just ugly. I want to refactor it, but I don't know a technique to iterate over "possible" types that obj can be.
How can I refactor this?
Thank you.