{"id":22408356,"url":"https://github.com/phmatray/therightcollection","last_synced_at":"2026-05-16T00:34:44.102Z","repository":{"id":235991937,"uuid":"791676646","full_name":"phmatray/TheRightCollection","owner":"phmatray","description":"A .NET console application demonstrating advanced collection management and event handling through a custom PersonCollection class that encapsulates typical list operations with added functionalities like sorting, filtering, and event-driven notifications.","archived":false,"fork":false,"pushed_at":"2024-04-25T07:03:04.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T07:27:54.348Z","etag":null,"topics":["collections","console-application","csharp","custom-collections","data-management","dotnet","encapsulation","event-handling","linq","oop"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phmatray.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-04-25T06:48:48.000Z","updated_at":"2024-07-02T08:23:10.000Z","dependencies_parsed_at":"2024-04-25T08:24:43.781Z","dependency_job_id":"f65c2c18-68fb-42b9-b9bb-2e1b0492c5d9","html_url":"https://github.com/phmatray/TheRightCollection","commit_stats":null,"previous_names":["phmatray/therightcollection"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phmatray%2FTheRightCollection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phmatray%2FTheRightCollection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phmatray%2FTheRightCollection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phmatray%2FTheRightCollection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phmatray","download_url":"https://codeload.github.com/phmatray/TheRightCollection/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245767274,"owners_count":20668822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["collections","console-application","csharp","custom-collections","data-management","dotnet","encapsulation","event-handling","linq","oop"],"created_at":"2024-12-05T11:17:23.471Z","updated_at":"2025-09-18T08:58:11.201Z","avatar_url":"https://github.com/phmatray.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The Right Collection\n\n## Overview\nThis project demonstrates how to encapsulate a collection of people in a custom collection class, `PersonCollection`, providing a more meaningful and controlled interface than built-in collection types in .NET. This class showcases best practices in object-oriented design, including encapsulation, event handling, and the use of LINQ for data manipulation.\n\n## Features\n\n- **Custom Collection**: `PersonCollection` is a custom class that encapsulates a list of `Person` objects and exposes a set of methods for interacting with the data more effectively.\n- **Indexers**: Provides two indexers, one for accessing `Person` objects by their index and another by their name.\n- **Advanced Query Capabilities**: Includes methods for sorting, filtering, and finding specific people based on attributes like name and age.\n- **Event Handling**: Implements events to notify other parts of the application when a person is added or removed.\n- **Statistics Methods**: Functions to retrieve statistical information such as the average age, the oldest person, and the youngest person from the collection.\n\n## Usage\n\n### Creating and Managing People\n\nYou can create a new instance of `PersonCollection` and add `Person` objects to it. Each person is represented with a name and an age. Here's how to add people to the collection:\n\n```csharp\nPersonCollection people = new PersonCollection();\npeople.Add(new Person(\"Alice\", 40));\npeople.Add(new Person(\"Bob\", 35));\npeople.Add(new Person(\"Charlie\", 50));\n```\n\n### Querying the Collection\n\nThe collection can be queried in various ways, such as finding people by name, sorting by age, or getting statistical data:\n\n```csharp\nvar bobs = people.FindByName(\"Bob\");\npeople.SortByAge();\nvar oldest = people.OldestPerson();\nvar youngest = people.YoungestPerson();\n```\n\n### Event Subscriptions\n\nYou can subscribe to `PersonAdded` and `PersonRemoved` events to get notified when changes occur in the collection:\n\n```csharp\npeople.PersonAdded += (sender, e) =\u003e Console.WriteLine($\"Person added: {e.Person.Name}\");\npeople.PersonRemoved += (sender, e) =\u003e Console.WriteLine($\"Person removed: {e.Person.Name}\");\n```\n\n## Running the Application\n\nTo run this application, compile the code using Visual Studio or the .NET CLI, and execute the built executable. The program will demonstrate the capabilities of the `PersonCollection` class through various operations displayed in the console output.\n\n## Contributions\n\nContributions are welcome. Please feel free to fork the repository, make changes, and submit a pull request. For major changes, please open an issue first to discuss what you would like to change.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphmatray%2Ftherightcollection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphmatray%2Ftherightcollection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphmatray%2Ftherightcollection/lists"}