Monday, March 26, 2012

What are Object Initializers?

The Object initializers are the features for programming concepts which was introduced in C#.Net.

The aim of using Object Initializers is to initializing the accessible fields or properties
of an object without the need to write any parametrized constructor or separate


using System;
class Student
int rollno;
string stdName;
static void Main()
Student s = new Student(){rollno=1,stdName="Ramesh" }; //Object Initializer

No comments:

Post a Comment