Object Initializer, a new technique to initialize an object of a class or collection, was introduced in the .NET 3.5 release (C# 3.0). Table of ContentsObject Initializer in C#.NETC# 3.0 Object InitializersC# Object Initializer Syntax After CompilationAdvantages of Object Initializer in C#C# 3.0 Object Initializer Summary Object Initializer in C#.NET C# Object Initializers allow you to […]
Automatic Properties In C# 3.0
In C# Properties are used to expose the local member variables. Till C# 2.0 version properties are defined by declaring a private member variable first and then declaring the property as stated below private string empName; Public string Empname { get { return empName; } set { empName= value; } } Table of ContentsC# Automatic […]
What is Friends Assembly in C#
An assembly that can access the Friend type(Visual Basic) or internal type (C#) member information are referred to as a “friend assembly“. You don’t have to mark types and members as public in order for them to be accessed by other assemblies if you identify an assembly as a friend assembly. Friend assembly is very […]
C# 2.0, Covariance And Contravariance In Delegates
In C# there is support for Covariance in arrays from C# version 1.0 itself. With C# 2.0 release the support for covariance and contravariance in C# has extended to delegates also. Table of ContentsCovariance And Contravariance In C# Covariance In C# Contravariance In C# C# Covariance Sample C# Contravariance SampleSummary Covariance And Contravariance In C# Delegates […]
How to handle File access IO exception in C#
If you are a .net programmer you may be familiar with the below-shown exception which says IO exception was unhandled, the process cannot access the file because it is being used by another process. In this article, I explain the sample code to get rid of this exception. At times, when you try to access […]
Differences Between Finalize and Dispose Methods in C# and VB.NET
This article is to give a clear understanding of the differences between Finalize and Dispose Methods in C#.This post is answer to following topics, – Finalize in C# and VB.NET – Dispose in C# and VB.NET – Finalize Vs Dispose in C# and VB.NET Managed resources are .NET objects and that are under the direct […]