Skip to content

Instantly share code, notes, and snippets.

@SimonCropp
Last active December 17, 2015 10:48
Show Gist options
  • Select an option

  • Save SimonCropp/5597182 to your computer and use it in GitHub Desktop.

Select an option

Save SimonCropp/5597182 to your computer and use it in GitHub Desktop.
// * Dont need [ImplementPropertyChanged] since it will be detected from the base class
// * Namespaces are noise. dont use them
// * use fielder so you dont need properties https://github.com/Fody/Fielder
// * I prefer property injection. simply less code
// * fields allow me to initialise them outside the constructor
public class FirstViewModel : MvxViewModel
{
public ICalculationService CalculationService;
public double Generosity = 20;
public double SubTotal = 100;
public double Tip
{
get { return CalculationService.Tip(SubTotal, Generosity); }
}
public double Total
{
get { return SubTotal + Tip; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment