Thursday, January 24, 2013

Viswaroopam Movie Review -- A Kamal Haasan Film

Since Viswaropam is not released today (25th Jan, 2013) at Tamil Nadu, Pondicherry due to security reasons. Most of the people want to know about the film on how good it is.

Please click the below link to view movie review.

http://www.apherald.com/Movies/Reviews/12541/Viswaroopam-Telugu-Movie-Review,-Rating---A-Kamal-Haasan-Film

Tuesday, December 4, 2007

C# 3.0 : Object Initialization

Usually object can be initialized by passing value to contructor. if we want to initialize the differnt property value in different situation, we need to create a more constructor for all the situation.

Conventional Method:

class Customer
{
#region Constructors

public Customer() {}

public Customer(long customerID)
{
CustomerID = customerID;
}

public Customer(long customerID, string name)
{
CustomerID = customerID;
Name = name;
}

#endregion


#region Automatic Properties

public long CustomerID
{
get;
set;
}

public string Name
{
get;
set;
}

#endregion
}

Initialization:

Customer custObj = new Customer(1);
Customer custObj1 = new Customer(1, "Pankaj");


C# 3.0:

But in C# 3.0, no need to create too much contructor for initializatoin. you can initialize the property without creating the constructor.

class Customer
{

#region Automatic Properties

public long CustomerID
{
get;
set;
}

public string Name
{
get;
set;
}

#endregion
}

Initialization:

Customer custSingle = new Customer { CustomerID = 1 };
Customer cust = new Customer { CustomerID = 1, Name = "Pankaj" };


Constructor and Initialization:

you can also call the constructor and initialize the property at the same time.

Customer custConst = new Customer(1) { CustomerID = 2, Name = "Pankaj" };


First call the constructor and then initialize the property.

So finally CustomerID value will be 2 instead of 1.

C# 3.