Skip to main content

Posts

Showing posts from May, 2021

Non-Generic Collection and Generic Collection in.NET

What is Collection in .NET? What is Collection in .NET? By Vishal Thakur Introduction Microsoft .NET provides a variety of collection data types that can store a set of records or values. There are two types of collections in .NET: generic collections and non-generic collections . Generic collections are type-safe at compile time, providing better performance compared to non-generic collections. They support type parameters when constructed and do not require boxing-unboxing or type conversion from the Object type when adding or removing items. Non-generic collections store items as Objects, require casting, and are not recommended for modern development. Most developers prefer generic collections because they are faster, safer, and less prone to exceptions and compile-time errors. To use non-generic collections, you need to include ...

Types of Exceptions in .NET

Types of Exceptions in .NET C# Types of Exceptions in .NET C# By Vishal Thakur Introduction An exception is an issue that occurs during the runtime of a software application. It typically happens when the developer does not manage the code properly or fails to handle certain scenarios. Exceptions can break the application if not handled correctly. In this blog, we will explore various types of exceptions in .NET C# and how to handle them. Exceptions Overview Exceptions in .NET have the following properties: To use exceptions, you need to import System.Exception . Always use a try block around the statements that might throw an exception. When an exception occurs, the flow of control jumps to the associated exception handler. In C#, the catch keyword is used to define an excep...