{"id":14966978,"url":"https://github.com/weingartner/reactivecompositecollections","last_synced_at":"2025-10-25T17:31:34.976Z","repository":{"id":79441081,"uuid":"46849357","full_name":"Weingartner/ReactiveCompositeCollections","owner":"Weingartner","description":"A .Net library for composing reactive collections.","archived":false,"fork":false,"pushed_at":"2022-09-14T11:38:48.000Z","size":1668,"stargazers_count":20,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-10T22:21:05.795Z","etag":null,"topics":["dotnet","linq","monad","reactive","reactiveui"],"latest_commit_sha":null,"homepage":null,"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/Weingartner.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}},"created_at":"2015-11-25T08:56:47.000Z","updated_at":"2024-01-02T10:03:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"6017a691-8469-48ac-a22e-158b07a71334","html_url":"https://github.com/Weingartner/ReactiveCompositeCollections","commit_stats":{"total_commits":70,"total_committers":6,"mean_commits":"11.666666666666666","dds":0.5142857142857142,"last_synced_commit":"0de000ea92dae2f77cd8d0e8539020f7ca087e54"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Weingartner%2FReactiveCompositeCollections","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Weingartner%2FReactiveCompositeCollections/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Weingartner%2FReactiveCompositeCollections/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Weingartner%2FReactiveCompositeCollections/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Weingartner","download_url":"https://codeload.github.com/Weingartner/ReactiveCompositeCollections/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219865216,"owners_count":16555929,"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":["dotnet","linq","monad","reactive","reactiveui"],"created_at":"2024-09-24T13:37:14.485Z","updated_at":"2025-10-25T17:31:34.516Z","avatar_url":"https://github.com/Weingartner.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ReactiveCompositeCollections [![NuGet](https://img.shields.io/nuget/v/ReactiveCompositeCollections.svg?maxAge=2592000)](https://www.nuget.org/packages/ReactiveCompositeCollections/)\nA .Net library for composing reactive collections providing monadic types to support LINQ.\n\n## Motivation \nWe often have heirachical components that maintain collections of things. Imagine a collection of 3D objects that\nall produce lines. The 3D objects could be arranged in nested components. What we want is to be able to collect all\nthe lines in the heirarchy as a flat reactive object\n\n    CompositeSourceList\u003cICompositeSourceList\u003cLine\u003e\u003e nestedLines = new CompositeSourceList\u003cICompositeSourceList\u003cLine\u003e\u003e();\n    \n    Widget wa = new Widget();\n    Widget wb = new Widget();\n    \n    nestedLines.Add(wa.Lines);\n    nestedLines.Add(wa.Lines);\n    \n    ICompositeList\u003cLine\u003e allLines = \n                   from lines in nestedLines\n                   from line in lines\n                   select line;\n                   \n    // Subscribe the the stream of flattened lines               \n    allLines.Items.Subscribe((ImmutableList\u003cLine\u003e lines)=\u003eRenderLines(lines));\n    \n    // or create an INPC object with a property Items\n    using(var s = allLines.Subscribe()){\n       RenderLines(s.Items);\n    }\n\n## Using ICompositeCollection with WPF.\n\nTo use the ICompositeCollectin you need to convert it to a ReadOnlyObservableCollection via the following method.\n\n        [Fact]\n        public void ShouldWorkWithRangeOperators()\n        {\n            var source0 = new CompositeSourceList\u003cint\u003e();\n            var source1 = new CompositeSourceList\u003cint\u003e();\n\n            var target = source0.Concat(source1);\n\n            using (var observableCollection = target.CreateObservableCollection(EqualityComparer\u003cint\u003e.Default))\n            {\n\n                observableCollection.Count.Should().Be(0);\n\n                source0.AddRange(new [] {0,1,2});\n\n                observableCollection.Should().Equal(0, 1,2);\n\n                source0.Add(1);\n                source1.Add(6);\n\n                observableCollection.Should().Equal(0, 1, 2, 1, 6);\n\n                source1.AddRange(new [] {3,4,5});\n\n                observableCollection.Should().Equal(0, 1, 2, 1, 6, 3, 4, 5);\n\n                source0.InsertRangeAt(1, new [] {6,7});\n\n                observableCollection.Should().Equal(0, 6, 7, 1, 2, 1, 6, 3, 4, 5);\n\n                source1.InsertRangeAt(1, new [] {6,7});\n                observableCollection.Should().Equal(0, 6, 7, 1, 2, 1, 6, 6, 7, 3, 4, 5);\n\n                source0.Source.Should().Equal(0, 6, 7, 1, 2,1);\n                source0.Replace(1,99);\n                observableCollection.Should().Equal(0, 6, 7, 99, 2, 1, 6, 6, 7, 3, 4, 5);\n\n\n            }\n        }\n\nNote that the ReadOnlyObservableCollection is IDisposable so you should get rid of it when you don't need\nit anymore.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweingartner%2Freactivecompositecollections","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweingartner%2Freactivecompositecollections","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweingartner%2Freactivecompositecollections/lists"}