PageRenderTime 38ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/DynamicSugar.Console/Person.cs

http://github.com/fredericaltorres/DynamicSugarNet
C# | 50 lines | 27 code | 9 blank | 14 comment | 2 complexity | fbc38d7dd8b64de53f159583566d8f27 MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace DynamicSugar.ConsoleApplication {
  6. /// <summary>
  7. /// A test class
  8. /// </summary>
  9. public class Person {
  10. public string LastName;
  11. public string FirstName { get; set; }
  12. public DateTime BirthDay { get; set; }
  13. public List<string> DrivingLicenses = new List<string>();
  14. public int Age {
  15. get{
  16. return DateTime.Now.Year - this.BirthDay.Year;
  17. }
  18. }
  19. public override string ToString() {
  20. return this.Format("LastName:{LastName}, FirstName:{FirstName}, Age:{Age}, BirthDay:{BirthDay}");
  21. }
  22. /// <summary>
  23. /// Implemented to test calling method with no parameter
  24. /// </summary>
  25. /// <returns></returns>
  26. public string LoadInformation() {
  27. return "Information";
  28. }
  29. /// <summary>
  30. /// Define how to determine if the person are the same.
  31. /// Implementing this method is required to use the extension
  32. /// method In().
  33. /// </summary>
  34. /// <param name="obj"></param>
  35. /// <returns></returns>
  36. public override bool Equals(object obj) {
  37. Person p = obj as Person;
  38. return (this.LastName==p.LastName) && (this.FirstName==p.FirstName) && (this.BirthDay==p.BirthDay);
  39. }
  40. }
  41. }