How to Convert an Array Into a Generic Type in C#

The following are the topics to be exlained in this article: Convert an array to a list Convert list to an array Convert an array to a dictionary Convert dictionary to an array Convert list to a dictionary Convert dictionary to a list Let’s say we have a class called “Student” with three auto-implemented properties. …

Advanced C# Interview Questions and Answers

What is Managed or Unmanaged Code?  Managed Code – The code, which is developed in .NET framework is known as managed code. This code is directly executed by CLR with the help of managed code execution. Any language that is written in .NET Framework is managed code. Unmanaged Code – The code, which is developed outside .NET …

Implement a Dispose method

Implementing the Dispose method is primarily for releasing unmanaged resources. When working with instance members that are IDisposable implementations, it’s common to cascade Dispose calls. Dispose() and Dispose(bool) The IDisposable interface requires the implementation of a single parameterless method, Dispose. Also, any non-sealed class should have an additional Dispose(bool) overload method to be implemented: A public non-virtual (NonInheritable in Visual Basic) IDisposable.Dispose implementation that has no parameters. A protected virtual (Overridable in Visual Basic) Dispose method …

Design a site like this with WordPress.com
Get started