C# struct

struct is something like a lightweight class. However, struct do not have a default constructor with no parameters, and it do not need a destructor too.

public struct classmates
{
public string name;
public string desc;
public string title;
public string sex;
}

struct can have properties and methods.
public struct classmates
{
public string name;
public string desc;
public string title;
public string sex;
public string knowsex
{
get { return sex;}
set { sex = value;}
}
public string getname()
{
return name;
}
}


endmemo.com © 2017  Terms of Use | Home