Skip to main content
1 of 3
palacsint
  • 30.4k
  • 9
  • 82
  • 157

I'm not too familiar with C#, so just a general note: Instead of structures like this:

if (type.IsAssignableFrom(_type))
{
    idsToTypes.Add(id, _type);
}
else
{
    throw new ArgumentException(String.Format("Registered type, {0}, was not assignable from {1}",_type,type));
}

You could write this:

if (type.IsAssignableFrom(_type))
{
    idsToTypes.Add(id, _type);
}
throw new ArgumentException(String.Format("Registered type, {0}, was not assignable from {1}", _type, type));

The else keyword is unnecessary in these cases.

palacsint
  • 30.4k
  • 9
  • 82
  • 157