Why You Should Avoid ArrayList in Modern C#

ArrayList is an obsolete non-generic collection from pre-2005 .NET that stores everything as object. Using ArrayList causes performance issues due to boxing/unboxing of value types, lacks compile-time type safety, leading to runtime exceptions. List<T> and other generic collections offer superior performance, type safety, and developer experience.

July 13, 2025 · 4 min · 660 words · Abhinaw
Diagram illustrating C# generics concept: type parameters and code reuse across multiple data types with type safety

C# Generics: A Complete Guide to Type-Safe, Reusable Code [With Examples]

Introduction to Generics in C# Generics are a game-changer in C# that let you write code that works with pretty much any data type, but still keeps all the safety checks in place. They showed up back in C# 2.0 and completely changed how we write reusable code. Think of generics like a recipe that doesn’t specify exactly what you’re cooking with. You could throw in beef, chicken, or tofu, the cooking instructions still work, but you don’t have to write separate recipes for each ingredient. The best part? The compiler still checks that you’re not accidentally using chicken when you said you’d use beef! ...

June 20, 2025 · Last modified: June 23, 2025 · 12 min · 2240 words · Abhinaw