To confuse matters slightly, a struct can contain constructors, constants, fields, methods, properties, indexers, operators, events, and nested types. A default constructor is provided by the compiler so you can initialize it with constructor type syntax. But you cannot write a default constructor for a struct yourself. Any constructors you write for a struct must have parameters.
This example demonstrates a simple struct type that has two public ints a and b. In a C# struct, everything is private unless explicitly declared public, the opposite of C++.
struct struct_testThe ToString() function overrides the function object.ToString(). All C# variables can do this. This provides an easy way to print out the value of a variable. By default though, for objects and structs, ToString() returns the name of the variable. You can override it, as I did to provide something more useful.
{
public int a;
public int b;
public struct_test(int newa,int newb) { // constructor
a = newa;
b = newb;
}
public override string ToString() {
return a.ToString() + " " + b.ToString() ;
}
}
On the next page : More About Structs

