C#: System.Object vs Generics

Always use generics! Using object’s results in cast operations and boxing/unboxing of value-types. Because of these reasons generics are faster and more elegant (no casting). And – the main reason – you won’t get InvalidCastExceptions using generics.

So, generics are faster and errors are visible at compile-time. System.Object means runtime exceptions and casting which in general results in lower performance (sometimes MUCH lower).

Leave a Comment