Monday 14 July 2014

C#.Net Basics: What is class? How to Declare a Class?

  • class is a construct that enables you to create your own custom types by grouping together variables of other types, methods and Events.
  • A class is like a blueprint. It defines the data and behavior of a type.
  • If the class is not declared as static, client code can use it by creating objects or instances which are assigned to a variable.
  • The variable remains in memory until all references to it go out of scope. At that time, the CLR marks it as eligible for garbage collection.
  • If the class is declared as static, then only one copy exists in memory and client code can only access it through the class itself, not an instance variable. 
  • Unlike  structs Classes support inheritance , a fundamental characteristic of object-oriented programming.
  • Classes are declared by using the class keyword,
  • The class keyword is preceded by the access level. The name of the class follows the class keyword.
  • The remainder of the definition is the class body, where the behavior and data are defined.
  • Fields, properties, methods, and events on a class are collectively referred to as class members.

             Access level class Customer
  {
    //Fields, properties, methods and events go here...
  }


 http://msdn.microsoft.com/en-us/library/x9afc042.aspx

No comments:

Post a Comment