Objects in C#

(Almost) Everything is an object is .net and C#. We all know that int, char, string, date, double etc are the primitive data types. But all these data types are derived from system.object.

To understand this lets take an example of int data type. We all know that int is derived from System.Int32; but we can declare the variable of int type using below mentioned two ways

int i = new int();
int j = 0;

where first option is like abject instance creation. When we use the . (dot) operator on i then it will give us different methods like .ToString(), .Equals() for object equality, .GetType() to get type. Hence this proves that all these primitives data types also derived from object (system.object) base class.

datatype

 

Advertisements

#object

DLL Hell

DLL hell is nothing but let say three applications are using the same dll for e.x. Spell Checker, then there is absolutly no problem in sharing the dll among these three, but bcz of some reason one application modified the dll then it will be of no use for others.

Another example: msword is using any dll and game installed on the same machine also using that and if we uninstall it then possibility of that dll corruption by game software is more.

.Net overcome this problem by maintaining versioning of dll(Assebmly : self discribing).There is no need to register it.

#dll-hell

Terminology & TLA’s (Three Latter Acronyms)

CLR : Common Language Runtime.
Managed Code: COde that is managed by the CLR.
Unmanaged COde: Non-.Net Code.
IL; MSIL; PCode: Microsoft Intermediate Language Code.
ASP: Active Server Pages.
Application Service Provider.
GC: Garbage Collection
Build/Compile: Creates an assembly containing MSIL.
Protected Code: Code with error handling.
XML: eXtensible Markup Language.
Validated XML: XML that conforms to a DTD.
DTD: A schema for an XML document.
DataSet: .NET cousin to the ADO recordset.
IDE: Integrated Development Environment(VS.NET).
Code Behind: Separate location for event code for a web page.

#terminology-tlas, #three-latter-acronyms

What is Serialization?

Serialization of object is very old technique and it does not depend on .NET.

When an object is serialized, the data stored in the object (including reference to other objects) is converted into the stream of bytes that can be more easily stored into the database or other file system.

This serialized data can be utilized in future to rebuild the object and this process is known as deserialization.

Before .NET it was possible to serialized/deserialized the object but it required more manual coding.

Since, object is base data type in .NET, serialization/deserialization functionality is built in to the Framework.

#serialization