Skip to content

Instantly share code, notes, and snippets.

@dnasca
Created March 17, 2015 06:42
Show Gist options
  • Select an option

  • Save dnasca/d7068ece5af7f343fe47 to your computer and use it in GitHub Desktop.

Select an option

Save dnasca/d7068ece5af7f343fe47 to your computer and use it in GitHub Desktop.
Types, and Type Members
//classes, structs, enums, interfaces, delegates are Types
//Types can only have internal, or public access modifiers
public class Customer
{
//fields are type members
#region Fields
//three private fields, to encapsulate these private fields, we will make three public properties
//these private fields are Type members, more specifically, type class members
//type members can have all access modifiers (private, protected, internal, protected internal, public)
private int _id;
private string _firstName;
private string _lastName;
#endregion
//properties are type members
#region Properties
public int Id
{
get { return _id; }
set { _id = value; }
}
public string FirstName
{
get { return _firstName; }
set { _firstName = value; }
}
public string LastName
{
get { return _lastName; }
set { _lastName = value; }
}
#endregion
//methods are type members
#region Methods
//returns a string
public string GetFullName()
{
return this._firstName + " " + this._lastName;
}
#endregion
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment