1. struct does not allow display and declaration of its non-parameter constructor, which is different from the class
2. When struct cannot be declared, initialize its data member Value
3. When struct is passed as a parameter, you can consider using ref to optimize performance: because it is a value type (but pay attention to its value change)
4. struct does not inherit, But it inherits from system. valuetype ----> system. Object
5. struct can be viewed as a narrow class, which is suitable for small data members.
6. Understand as follows: Code : Class Class1
{
[Stathread]
Static Void Main ( String [] ARGs)
{
Dimensions point = New Dimensions ();
Console. writeline (point );
Dimensions point1;
Point1.length = 100 ;
Point1.width = 200 ;
Console. writeline (point1 );
Console. Readline ();
}
}
Public Struct Dimensions
{
Public Double Length;
Public Double Width;
Public Override String Tostring ()
{
Return This. Length+ ":" + This. Width;
}
}