Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. using namespace System;
  2. using namespace System::Collections::Generic;
  3. using namespace System::Linq;
  4.  
  5. public ref class Abiturient
  6. {
  7. public:
  8. property String^ LastName;
  9. property String^ Address;
  10. property Double AverageGrade;
  11. Abiturient(String^ ln, String^ a, Double ag)
  12. {
  13. LastName = ln;
  14. Address = a;
  15. AverageGrade = ag;
  16.  
  17. }
  18.  
  19. ~Abiturient()
  20. {
  21. }
  22.  
  23. };
  24.  
  25. ref class Filter
  26. {
  27. private: double _value;
  28.  
  29. public:
  30. Filter(double value): _value(value) {}
  31. bool Predicate(Abiturient ^a)
  32. {
  33. return a->AverageGrade > _value;
  34. }
  35. };
  36.  
  37. int main(array<System::String ^> ^args)
  38. {
  39. auto abiturients = gcnew List<Abiturient^>();
  40. auto filter = gcnew Filter(2.0);
  41. auto filtered = Enumerable::Where(abiturients, gcnew Func<Abiturient^, bool>(filter->Predicate));
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement