//Visual Basic 2010 Object Initializers Object Oriented Programming public class Person { private string m_Name; private Address m_Address; public virtual string Name { get { Name = this.m_Name; } set { this.m_Name = value; } } public virtual Address Address { get { Address = this.m_Address; } set { this.m_Address = value; } } } public class Address { private string m_Street; private string m_City; private string m_ZipCode; public virtual string Street { get { Street = this.m_Street; } set { this.m_Street = value; } } public virtual string City { get { City = this.m_City; } set { this.m_City = value; } } public virtual string ZipCode { get { ZipCode = this.m_ZipCode; } set { this.m_ZipCode = value; } } } public class Counter { private int m_Value; private int m_StepValue; public Counter(int value) { this.m_Value = value; } public virtual int Value { get { Value = this.m_Value; } } public virtual int StepValue { get { StepValue = this.m_StepValue; } set { this.m_StepValue = value; } } public virtual void Raise() { this.m_Value += new System.EventHandler(StepValue); } } public class Example { public static void Main() { Person person1 = new Person(); } } //Bezoek www.vbvoorbeelden.be voor meer C# voorbeelden. //Copyright - De Wolf / vbvoorbeelden - 2003-2011 - Alle rechten voorbehouden.