text: A structure in C# is simply a composite data type consisting of a number elements of other types. A C# structure is a value type and the instances or objects of a structure are created in stack. The structure in C# can contain fields, methods, constants, constructors, properties, indexers, operators and even other structure types.
  Structure Declaration & Object Creation
  The keyword struct can be used to declare a structure. The general form of a structure declaration in C# is as follows.
  <modifiers>
  For example struct MyStruct{public int x;public int y;}
  MyStruct ms =
  ms.x = 10;ms.y = 20;
  MyStruct ms;
  Structs & Fields
  A struct in C# can contain fields. These fields can be declared as private, public, internal. Remember that inside a struct, we can only declare a field. We can't initialize a field inside a struct. However we can use constructor to initialize the structure fields.
  The following is not a valid C# struct and the code will not compile, since the fields inside the structure are trying to initialize.
  struct
  // Author: rajeshvs@msn.com
  However a struct can contain static fields, which can be initialized inside the struct. The following example shows the use of static fields inside a struct.
  // Author: rajeshvs@msn.com
  Struct & Methods
  A C# struct can also contain methods. The methods can be either static or non-static. But static methods can access only other static members and they can't invoke by using an object of the structure. They can invoke only by using the struct name.
  An example is shown below.
  // Author:rajeshvs@msn.com
  Structs & Properties
  The properties can be declared inside a struct as shown below.
  //C#: Property// Author: rajeshvs@msn.com
  The indexers can also be used with a C# struct. An example is shown below.
  The operators can be overloaded inside a C# structure also. The same rules applicable with respect to a C# class is also applicable here. Both unary and binary operators can be overloaded.
  There is no inheritance for structs as there is for classes. A struct can't inherit from another struct or class and it can't be the base class for a class. But remember that in C# all types are directly or indirectly inheriting from the super base class object and hence the structure also. Since structs doesn't support inheritance, we can't use the keywords virtual, override, new, abstract etc with a struct methods. C# struct types are never abstract and are always implicitly sealed. The abstract or sealed modifiers are not permitted in a struct declaration.
  Since inheritance is not supported for structs, the declared accessibility of a struct member can't be protected or protected internal. Since all struct types are implicitly inherit from object class, it is possible to override the methods of the object class inside a struct by using the keyword override. Remember that this is special case in C# structs.
  Structs & Interfaces
  Just like classes, a C# struct can also implement from an interface. For example
  The structs in C# seems to similar to classes. But they are two entirely different aspects of the language. The classes are reference types while a struct is a value type in C#. The objects of class types are always created on heal while the objects of struct types are always created on the stack. But C# structs are useful for small data structures that have value semantics. Complex numbers, points in a co-ordinate systems etc are good examples for struct types.
  Understanding Structures in C#
  Pointers in C#
  why we have to use new keyword while struct object .struct is value type still we are using new keyword
  You have written:
  -----------------
  Structs & Properties
  The properties can be declared inside a struct as shown below.
  //C#: Property
  // Author: rajeshvs@msn.com
  using System;
  class MyStruct
  ---------------------
  Please change the 'class' keyword to 'struct'
  Can we assign the intger value in an object again and agin?
  using System;
  struct MyStruct
  {
  public int x = 25;
  public void SetX(int i)
  { x = i; }
  }
  class MyClient
  public static void Main()
  {
  MyStruct ms = new MyStruct();
  ms.SetX(100);
  // Store this object somewhere then again collect this object and
  // assign different value.
  ms.SetX(102);
  }