Skip to content

Instantly share code, notes, and snippets.

@brendanmckenzie
Forked from anonymous/gist:6088906
Last active December 20, 2015 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brendanmckenzie/6088912 to your computer and use it in GitHub Desktop.
Save brendanmckenzie/6088912 to your computer and use it in GitHub Desktop.
/* long-hand */
public class MyClass
{
string _myString;
public string MyString
{
get { return _myString; }
set { _myString = value; }
}
}
/* short-hand */
public class MyClass
{
public string MyString { get; set; }
}
# long-hand
class MyClass:
def __init__(self):
self._my_string = None
@property
def my_string(self):
return self._my_string
@my_string.setter
def my_string(self, value):
self._my_string = value
# short-hand
class MyClass:
my_string = None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment