properties types in Microsoft.Net Framework

how we create

trimurarisingh
Views: 1834 | Community Opinion: 3

Tags..  VB.NET  C#  .NET Framework

Bookmark this page..



Ask a New Question Go to Home

Community Opinion/Answers
 
trimurarisingh Said..

Properties are named members of classes, structs, and interfaces. They provide a flexible mechanism to read, write, or compute the values of private fields through accessors.

Properties are an extension of fields and are accessed using the same syntax. Unlike fields, properties do not designate storage locations. Instead, properties have accessors that read, write, or compute their values.

Usually inside a class, we declare a data field as private and will provide a set of public SET and GET methods to access the data fields. This is a good programming practice, since the data fields are not directly accessible out side the class. We must use the set/get methods to access the data fields. Properties can be used in any .Net Language like VB.Net, C# etc.





using System;
public class Employee
{
public static int numberOfEmployees;
private static int counter;
private string name;

// A read-write instance property:
public string Name
{
get
{
return name;
}
set
{
name = value;
}
}

// A read-only static property:
public static int Counter
{
get
{
return counter;
}
}

// Constructor:
public Employee()
{
// Calculate the employee's number:
counter = ++counter + numberOfEmployees;
}
}

////////////////////////////////////////////////////////////

public class MainClass
{
public static void Main()
{
Employee.numberOfEmployees = 100;
Employee e1 = new Employee();
e1.Name = "Claude Vige";
Console.WriteLine("Employee number: {0}", Employee.Counter);
Console.WriteLine("Employee name: {0}", e1.Name);
}
}




replica watches Said..

replica cartier watches are costly little question, however they are only a small fraction of the price of the unique Cartier. No, it isn't Swiss. Cartier is a French jeweler and maker of luxurious merchandise and accessories. They are finest known as jewelers and their RePLica WaTCHes are certainly jewels - extremely-luxurious timepieces created using essentially the most treasured metals and best gems. Cartier has been generally known as jeweler to kings, king of jewelers? They've a royal warrant, that is, they are the designated jewelers for the British royal family. It is a uncommon distinction for a jeweler. But the British royal family is not the only royal family they serve. Similar warrants have been obtained from royalty in Egypt, Romania, Serbia, Belgium, Serbia, Greece, Siam, Monaco, Russia, Portugal and Spain. By now, anyone studying this will need to have gauged simply how costly and unique Cartier is. Hence the need for replica Cartier watches!






What do you think? Add your opinion/answer
*Name
*your opinion/answer: