{"id":31798338,"url":"https://github.com/emako/liteobservablecollections","last_synced_at":"2026-02-13T15:02:00.115Z","repository":{"id":317639612,"uuid":"1044475265","full_name":"emako/LiteObservableCollections","owner":"emako","description":"Lite version of ObservableCollections with fewer features but better performance.","archived":false,"fork":false,"pushed_at":"2026-02-03T08:26:05.000Z","size":436,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-02-03T16:34:32.048Z","etag":null,"topics":["avalonia","mvvm","observablecollections","wpf"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/LiteObservableCollections/","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/emako.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,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-25T18:34:09.000Z","updated_at":"2026-02-03T08:23:40.000Z","dependencies_parsed_at":"2025-10-02T05:53:12.752Z","dependency_job_id":"0ed07637-566f-4994-82b8-60860ed252da","html_url":"https://github.com/emako/LiteObservableCollections","commit_stats":null,"previous_names":["emako/liteobservablecollections"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/emako/LiteObservableCollections","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emako%2FLiteObservableCollections","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emako%2FLiteObservableCollections/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emako%2FLiteObservableCollections/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emako%2FLiteObservableCollections/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emako","download_url":"https://codeload.github.com/emako/LiteObservableCollections/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emako%2FLiteObservableCollections/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29411138,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T06:24:03.484Z","status":"ssl_error","status_checked_at":"2026-02-13T06:23:12.830Z","response_time":78,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["avalonia","mvvm","observablecollections","wpf"],"created_at":"2025-10-10T21:26:21.678Z","updated_at":"2026-02-13T15:01:59.298Z","avatar_url":"https://github.com/emako.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NuGet](https://img.shields.io/nuget/v/LiteObservableCollections.svg)](https://nuget.org/packages/LiteObservableCollections) [![Actions](https://github.com/emako/LiteObservableCollections/actions/workflows/library.nuget.yml/badge.svg)](https://github.com/emako/LiteObservableCollections/actions/workflows/library.nuget.yml) \n\n# LiteObservableCollections\n\nLite version of ObservableCollections with fewer features but better performance.\n\n## Features\n\n- Lightweight observable list and collection implementations.\n- Implements `INotifyCollectionChanged` and `INotifyPropertyChanged`.\n- Supports batch addition via `AddRange`.\n- **ObservableViewList**: reactive view over `ObservableList\u003cT\u003e` with filter, sort, and optional projection; filter/sort are persisted across source updates.\n\n## Usage\n\n### ObservableList\u003cT\u003e\n\n```csharp\nusing LiteObservableCollections;\n\nvar list = new ObservableList\u003cint\u003e();\nlist.CollectionChanged += (s, e) =\u003e Console.WriteLine($\"Action: {e.Action}\");\nlist.Add(1);\nlist.Add(2);\nlist.AddRange(new[] { 3, 4, 5 }); // AddRange triggers a Reset event\nConsole.WriteLine(string.Join(\", \", list)); // Output: 1, 2, 3, 4, 5\n```\n\n### ObservableCollection\u003cT\u003e\n\n```csharp\nusing LiteObservableCollections;\n\nvar collection = new ObservableCollection\u003cstring\u003e();\ncollection.CollectionChanged += (s, e) =\u003e Console.WriteLine($\"Action: {e.Action}\");\ncollection.Add(\"A\");\ncollection.Add(\"B\");\ncollection.AddRange(new[] { \"C\", \"D\" }); // AddRange triggers a single Add event with all new items\nConsole.WriteLine(string.Join(\", \", collection)); // Output: A, B, C, D\n```\n\n### Move Support\n\nBoth types support moving items:\n\n```csharp\nlist.Move(0, 2); // Moves the first item to index 2\ncollection.Move(1, 0); // Moves the second item to the first position\n```\n\n### ObservableViewList\\\u003cT\\\u003e\n\nA reactive view over an `ObservableList\u003cT\u003e` that supports filtering and sorting. Changes in the source list are reflected in the view. Filter and sort are persisted: `Refresh()` (e.g. when the source changes) re-applies them.\n\n**View without projection** (same element type):\n\n```csharp\nvar source = new ObservableList\u003cstring\u003e { \"Banana\", \"Apple\", \"Cherry\" };\nusing var view = new ObservableViewList\u003cstring\u003e(source);\n\n// Filter: only items containing \"a\"\nview.AttachFilter(s =\u003e s.Contains('a'));\n// view: Banana, Apple\n\n// Reset filter\nview.ResetFilter();\n\n// Sort by default comparer (or AttachSort(comparison))\nview.AttachSort();\n// view: Apple, Banana, Cherry\n\n// Restore source order\nview.ResetSort();\n```\n\n**View with projection** (`ObservableViewList\u003cTSource, TResult\u003e`):\n\n```csharp\nvar source = new ObservableList\u003cint\u003e { 1, 2, 3 };\nusing var view = new ObservableViewList\u003cint, string\u003e(source, x =\u003e $\"Item {x}\");\n// view: \"Item 1\", \"Item 2\", \"Item 3\"\n\nview.AttachFilter(x =\u003e x \u003e= 2);\n// view: \"Item 2\", \"Item 3\"\n```\n\n- `AttachFilter(predicate)` / `ResetFilter()` — filter operates on source elements (before projection).\n- `AttachSort()` / `AttachSort(comparer)` / `AttachSort(comparison)` / `ResetSort()` — sort operates on view elements. Sort is re-applied on each `Refresh()`.\n- `ObservableViewList` implements `IDisposable`; dispose to unsubscribe from the source.\n\n## Why AddRange?\n\nThe `AddRange` method allows you to efficiently add multiple items at once, reducing the number of notifications and improving performance in UI scenarios.\n\n- `ObservableList\u003cT\u003e.AddRange` triggers a `Reset` event for maximum compatibility.\n- `ObservableCollection\u003cT\u003e.AddRange` triggers a single `Add` event with all new items, which is more efficient for most UI frameworks.\n\n## License\n\n[MIT](LICENSE)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femako%2Fliteobservablecollections","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femako%2Fliteobservablecollections","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femako%2Fliteobservablecollections/lists"}