How many types of classes in .Net?

The class is one of the two basic encapsulation constructs in C# (the other being the struct). Every executable statement must be placed inside a class or struct. Classes define reference types that are the basic building blocks of C# programs, and they are the architectural blueprint for the “objects” in OOP. Types of classes :- Abstract: An instance of the class cannot be created. Usually this means the class is intended to serve as a base class. Abstract methods must be overridden in a derived class. If any method of a class is abstract, the entire class must be … Click here to continue reading.

What is Managed Code?

Managed Code is what Visual Basic .NET and C# compilers create. It compiles to Intermediate Language (IL), not to machine code that could run directly on your computer. The IL is kept in a file called an assembly, along with metadata that describes the classes, methods, and attributes (such as security requirements) of the code you’ve created. This assembly is the one-stop-shopping unit of deployment in the .NET world. You copy it to another server to deploy the assembly there—and often that copying is the only step required in the deployment. Managed code runs in the Common Language Runtime. The … Click here to continue reading.

How to increased array length dynamically?

public static Array ExpandArray(Array arr, object newElement) { int length = 1; System.Type type = newElement.GetType(); if (arr != null) { length += arr.Length; type = arr.GetType().GetElementType(); } Array result = Array.CreateInstance(type, length); if (arr != null) { arr.CopyTo(result, 0); } result.SetValue(newElement, result.Length – 1); return result; }

What is Native Code?

The phrase native code is used in two contexts. Many people use it as a synonym for unmanaged code: code built with an older tool, or deliberately chosen in Visual C++, that does not run in the runtime, but instead runs natively on the machine. This might be a complete application, or it might be a COM component or DLL that is being called from managed code using COM Interop or PInvoke, two powerful tools that make sure you can use your old code when you move to the new world. I prefer to say unmanaged code. for this meaning, … Click here to continue reading.