C # knowledge structure

What is the structure?

  Structure is a value type data structure. A single variable such that it may store data related to various types of data. struct  keyword is used to create the structure.

       Under normal circumstances, or used in class (class, reference type) a little more.

Define a structure:

///  <Summary> 
/// define a rectangular configuration
 ///  </ Summary> 
public  struct the Rectangle 
{ 
    public  int the Width { GET ; SET ;}
     public  int the Height { GET ; SET ;} 
}

Declare a structure:

var rectangle = new Rectangle
{
    Width = 100,
    Height = 50
};

It is a value type configuration:

var rectangle2 = rectangle;
var isEquals = rectangle2.Equals(rectangle);
// isEquals = true;

 

Guess you like

Origin www.cnblogs.com/gme5/p/11407415.html