Skip to content

Instantly share code, notes, and snippets.

@DaRaFF
Created June 3, 2011 12:03
Show Gist options
  • Save DaRaFF/1006234 to your computer and use it in GitHub Desktop.
Save DaRaFF/1006234 to your computer and use it in GitHub Desktop.
Properties in C#
class Data {
FileStream s;
public string FileName {
set { s = new FileStream( value, FileMode.Create ); }
get { return s.Name; }
}
}
Data d = new Data();
d.FileName = "myFile.txt"; // calls set("myFile.txt");
string s = d.FileName; // calls get();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment