Company.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.Collections.Generic;
  3. namespace Jint.Tests.Runtime.Domain
  4. {
  5. public class Company : ICompany, IComparable<ICompany>
  6. {
  7. private string _name;
  8. private readonly Dictionary<string, string> _dictionary = new Dictionary<string, string>()
  9. {
  10. {"key", "value"}
  11. };
  12. public Company(string name)
  13. {
  14. _name = name;
  15. }
  16. string ICompany.Name
  17. {
  18. get => _name;
  19. set => _name = value;
  20. }
  21. string ICompany.this[string key]
  22. {
  23. get => _dictionary[key];
  24. set => _dictionary[key] = value;
  25. }
  26. public string Item => "item thingie";
  27. int IComparable<ICompany>.CompareTo(ICompany other)
  28. {
  29. return string.Compare(_name, other.Name, StringComparison.CurrentCulture);
  30. }
  31. public IEnumerable<char> GetNameChars()
  32. {
  33. foreach (var c in _name)
  34. {
  35. yield return c;
  36. }
  37. }
  38. }
  39. }